Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell 2.0 continue script after reboot

$
0
0

I am using PS 2.0 and I am trying to display a textbox message and restart the computer and display a second textbox message.

[System.Windows.Forms.MessageBox]::Show("Restarting.")
$RunOnceKey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce" 
set-itemproperty $RunOnceKey "ConfigureServer" ('C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -File "C:\sw\test.ps1"')
Restart-Computer -ErrorAction stop
[System.Windows.Forms.MessageBox]::Show("Yay.")

I think I need to add more to this, but I am not sure what.

Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>