Hi, I want to deploy PowerShell script to all Windows 7 machines in my domain as logon script via GPO. That script does the following:
1)if app called celik is installed but old version of it, uninstall it and install new version - checks both variants (x86 or x64 machine)
2)if app called celik is not installed, install new version of it
My problem is that on test client machine script always runs under credentials of logged-on user that is not member of local admin group so uninstall/install of celik app fails every time. I tried with creating PSCredential object of local administrator account but when I passed it to Start-Process msiexec.exe with -Credential $credential nothing happened on client machine. Also using private functions works well when script is run locally from ISE on client machine but via GPO that does not work.
NOTE: I also tried to deploy this script as startup script via GPO thus account under script was run should have been at least Local System which should have rights to uninstall/install app on local machine - nothing happened despite gpresult /r showed that GPO was successfully applied to computer.