none
Poweshell Logon Script not working

    Question

  • 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
    }


    Wednesday, January 14, 2015 5:38 AM

Answers

All replies