Skip to content

Commit 6fc4026

Browse files
committed
update messaging and version
1 parent 747b8d1 commit 6fc4026

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Please be careful about removing existing code as it may be applicable to scenar
3434
Write-Host $OSMajorMinorVersionString
3535
```
3636
4. Export the registry key: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WSMAN
37-
5. Name the file "Pristine-WSMan-<OSVersionStringFromAbove>" and place it next to Undo-WinRMConfig.ps1
37+
5. Name the file "Pristine-WSMan-<OSVersionStringFromAbove>" and carefully add it as a here string in Undo-WinRMConfig.ps1. Follow the other examples to ensure that the OS lookup routine will find your addition. Notice that only the first two segments of the OS Version number are used.
3838
6. Do NOT add any other registry keys to the file
3939
7. Test that your code works - both to return to pristine and that the system can reconfigure wsman with conventional methods.
4040
1. Configure wsman

Undo-WinRMConfig.ps1

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ Param (
4545
[switch]$Version
4646
)
4747

48-
$ThisScriptVersion = '1.1.7'
48+
$ThisScriptVersion = '1.1.8'
4949

5050
If ($version)
5151
{
@@ -126,7 +126,7 @@ Function Setup-Undo {
126126
$Key1 = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\Scripts\Shutdown\0'
127127
$Key2 = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\State\Machine\Scripts\Shutdown\0'
128128
$keys = @($key1,$key2)
129-
$scriptpath = "$env:windir\System32\GroupPolicy\Machine\Scripts\Shutdown\undowinrmconfig.ps1"
129+
$scriptpath = "$env:windir\System32\GroupPolicy\Machine\Scripts\Shutdown\Undo-WinRMConfig.ps1"
130130
$scriptfilename = (Split-Path -leaf $scriptpath)
131131
$ScriptFolder = (Split-Path -parent $scriptpath)
132132
$FileContents = Get-Variable -name "Pristine-WSMan-${OSMajorMinorVersionString}.reg" -ValueOnly
@@ -158,8 +158,10 @@ Function Setup-Undo {
158158
$UndoWinRMScript += "Register-ScheduledJob -Name CleanUpWinRM -RunNow -ScheduledJobOption @{RunElevated=$True;ShowInTaskScheduler=$True;RunWithoutNetwork=$True} -ScriptBlock $selfdeletescript"
159159

160160
Write-Host "Creating $scriptpath, with the following contents:"
161+
Write-Host '*******************'
161162
Write-Host "$UndoWinRMScript"
162-
If (!(Test-Path $ScriptFolder)) {New-Item $ScriptFolder -type Directory -force}
163+
Write-Host '*******************`r`n`r`n'
164+
If (!(Test-Path $ScriptFolder)) {New-Item $ScriptFolder -type Directory -force | Out-null}
163165
Set-Content -path $scriptpath -value $UndoWinRMScript
164166

165167
Foreach ($Key in $keys)
@@ -186,9 +188,9 @@ Function Setup-Undo {
186188
"[Shutdown]" | Out-File $psScriptsFile
187189
"0CmdLine=$scriptfilename" | Out-File $psScriptsFile -Append
188190
"0Parameters=$parameters" | Out-File $psScriptsFile -Append
189-
}
190191

191-
Write-Host "`r`n`r`nUndo-WinRMConfig (v${version}) is staged to run at next shutdown. To unstage, run 'Undo-WinRMConfig -RemoveShutdownScriptConfig'"
192+
Write-Host "`r`n`r`nUndo-WinRMConfig (v${ThisScriptVersion}) is staged to run at next shutdown. To unstage, run 'Undo-WinRMConfig -RemoveShutdownScriptConfig'"
193+
}
192194

193195
${Pristine-WSMan-10.0.reg} = @'
194196
Windows Registry Editor Version 5.00

0 commit comments

Comments
 (0)