You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* formatting (fix whitespace, remove blank lines, expand aliases, brace style K&R/OTBS)
* fallback to 'localhost' for $ComputerName with HelpMessage; allow '127.0.0.1' to be used for the local machine
* bump version
* add switch parameter $ExpandResultForSingleComputer
This example checks various registry values to see if the local computer is pending a reboot.
39
39
#>
40
40
[CmdletBinding()]
41
41
param(
42
-
# ComputerName is optional. If not specified, localhost is used.
42
+
[Parameter(HelpMessage='Optional parameter. If omitted, "localhost" (the local machine) is inferred. If not working locally, the target machine must have PS remoting enabled and winrm running.')]
43
43
[ValidateNotNullOrEmpty()]
44
-
[string[]]$ComputerName,
45
-
44
+
[string[]]$ComputerName='localhost',
45
+
46
46
[Parameter()]
47
47
[ValidateNotNullOrEmpty()]
48
-
[pscredential]$Credential
48
+
[pscredential] $Credential,
49
+
50
+
[switch] $ExpandResultForSingleComputer
49
51
)
50
52
51
53
$ErrorActionPreference='Stop'
@@ -65,7 +67,7 @@ $scriptBlock = {
65
67
[ValidateNotNullOrEmpty()]
66
68
[string]$Key
67
69
)
68
-
70
+
69
71
$ErrorActionPreference='Stop'
70
72
71
73
if (Get-Item-Path $Key-ErrorAction Ignore) {
@@ -86,7 +88,7 @@ $scriptBlock = {
86
88
[ValidateNotNullOrEmpty()]
87
89
[string]$Value
88
90
)
89
-
91
+
90
92
$ErrorActionPreference='Stop'
91
93
92
94
if (Get-ItemProperty-Path $Key-Name $Value-ErrorAction Ignore) {
@@ -107,7 +109,7 @@ $scriptBlock = {
107
109
[ValidateNotNullOrEmpty()]
108
110
[string]$Value
109
111
)
110
-
112
+
111
113
$ErrorActionPreference='Stop'
112
114
113
115
if (($regVal=Get-ItemProperty-Path $Key-Name $Value-ErrorAction Ignore) -and$regVal.($Value)) {
0 commit comments