Quantcast
Channel: Group Policy forum
Viewing all articles
Browse latest Browse all 19997

Poweshell Logon Script not working

$
0
0

Hi All,

 I just add the following User logon Script to Powershell Script and set the Run Windows Powershell script last.

No Parameters.

  When i run this onWorkstation i have to run  "Set-ExecutionPolicy RemoteSigned" on PS to execute this.

What i did wrong?

$ArgumentsStandard =" /quiet "
$ArgumentsStandard +="/norestart"
$App = Get-Content "\\server\Softwareshare\un-installApp.txt"

#gwmi gets the list of applications
# where selects just the apps im interested in removing
# start-process removes each app using msiexec with quiet and norestart options

Write-Host "start un-installing software from list"
gwmi win32_product |
where { $App -contains $_.Name } |
ForEach-Object {
	Write-Host "start un-installing $_.name"
	$Arguments =  "/uninstall "
	$Arguments += $_.IdentifyingNumber
	$arguments += $ArgumentsStandard
	Start-Process "MSIExec" -ArgumentList $Arguments -wait
}



Viewing all articles
Browse latest Browse all 19997

Trending Articles



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