I have written a powershell script which generates a "EULA" type popup which the user has to agree to.
It does this at logon by running as a scheduled task for a user (non-admin) account. It needs to run elevated, so I am using the following script to run it elevated:
$pw= convertto-securestring "myPassw0rd" -asplaintext –force
$credential = new-object -typename system.management.automation.pscredential -argumentlist "-default-",$pw
$localArgs = "/c Powershell c:\scripts\myScript.ps1"
[System.Diagnostics.Process]::Start("cmd.exe", $localArgs, "Administrator", $credential.Password, $computer)
(I will be encrypting the password to make it slightly more secure, but that's not relevant to this question.)
Anyway – my problem is that when the script is called it displays the command prompt window behind my "pretty" EULA popup.
Is there a way to hide / minimise the command window?
Thanks,
Ben
Best Answer
This should be what you need: