start-process -Credential $Credential won't work when running from self service portal
But runs when running it locally "powershell.exe -File "c:\whatever\filename.ps1"
all the other parts of the script is running well so I won't bother posting the whole thing that grants and revokes Write access to local users while notepad is open. Here is the first line that collects the credentials, and the 2nd that is failing to run when running from store.
$Credential = $host.ui.PromptForCredential("Need credentials", "Please enter your username and password.", "NetBiosUserName")
Start-Process -Credential $Credential -FilePath C:\windows\notepad.exe -ArgumentList "c:\windows\system32\drivers\etc\hosts" -Wait
not a typo issue when entering username + pw 100%.