Skip to content

Trigger a reboot with DSC Script Resource

August 25, 2017
Script RebootWhenSet
{
	GetScript = {
		# TestScript = $true
		return @{ Result = "Some value" };
 
        	# TestScript = $false
		# return @{ Result = $null };
	}
	SetScript = {
        	# Set things
        	# ...
 
		$global:DSCMachineStatus = 1;
	}
	TestScript = {
		$result = (Invoke-Expression -Command $GetScript)["Result"];
 
		if($result)
		{
			return $true;
		}
 
		return $false;
	}
}
Advertisements

From → DSC, PowerShell

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: