I have spent most the day researching the best and most simplest way to accomplish this and there doesn't seem to be one. I have found bits and pieces but I haven't been able to successfully make them work. I just simply want to display a pop up message to the user by running a Powershell script. I would like to have the script do the following:
1. The popup would give an action for input by the user,
2. The message will tell them their computer will be restarted to complete a Windows 1809 upgrade,
3. The user will click ok and the input, along with the username and machine name will be sent to a log file.
4. The script would have a timer on it that will restart the computer within 30 minutes whether the input is given or not.
The code below does what I want, minus the timer, but doesn't bring a pop up message to the user. It just gives the message in a Powershell console. How can I get it to do the same thing but in a pop-up message instead?
$HostName = $env:COMPUTERNAME
$PatchLocation = "c:\Temp\"
$LogFile = "responses.log"
$LogPath = $PatchLocation + $LogFile
$date = Get-Date
$response = Invoke-Command -ComputerName $HostName -ScriptBlock{ Read-Host "Your computer will be restarted in 30 minutes. Please save your work. Type 'Agree' If you have saved your work"}
"Response for $HostName is $response - $date"|Out-File -FilePath $LogPath -Append