when you deploy an application or package in cm2012 does it rely on the local system path to find anything? Like msiexec.exe or powershell.exe?
Technology Tips and News
when you deploy an application or package in cm2012 does it rely on the local system path to find anything? Like msiexec.exe or powershell.exe?
Hi,
Yes if you don't specify the full path to the .exe file for instance msiexec.exe the path must be in then System environment path for the SCCM client to be able to find it.
Regards,
Jrgen
ok, that explains a lot. So if I want to run a .PS1 script what do I actual enter on my Package Command Line?
C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe MyScript.ps1 ? (this did not seem to work)
Since MyScript.ps1 is in a random folder in C:\windows\cache\ how do you specify it when your path is messed up?
C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe .\MyScript.ps1
Although take a look at the following:
https://dynamicdatacenter.wordpress.com/2012/10/01/run-powershell-script-from-software-package/
You can use below command based on the OS version :
for 32bit OS ,command line looks something like this :
%windir%\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file .\Myscript.ps1 If you want to run the powershell on 64bit machines, You can try below command. %windir%\Sysnative\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file .\Myscript.ps1We deployed a WebEx client software to all of our workstations. After that our system PATH was no longer a reg_expand_sz it was changed to a reg_sz registry type and our deployments don't work. Also, if you open up a cmd window and type in any command (calc, msiexec) it can't find them. you have to CD Windows\System32 and then the command works.
What is very odd is I have setup a machine and then manually installed the WebEx software and the reg key did not change. So I'm not thinking this is malware.
Question: if you run a PowerShell script via a Computer GPO does that too require a healthy path? If it does I'll have to use psexec to find our whole environment :-(
You don't require the path if you are specifying the full path manually via your script.
e.g C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file .\Myscript.ps1
This will work on both 32 and 64 bit devices calling the 32bit version of PowerShell.
On different machines you will have different entry's in the path statement as different installers append , prefix their own path info.
how about if you need to run a .CMD file? what I've done in the past is this: I have a .CMD file that does some stuff and then uses %~dp0 to call a .EXE or .MSI from the c:\windows\cache\xyz folder.
What I just tried was this.
and when I run this it fails with this error message.
so how do I run this so it works?
In the command line window you just posted you just need to put InstallCitrix.cmd
I usually just hit browse and select the file directly, saves any typos
that worked. I was worried since the target machine I deployed too has the incorrect PATH key 'type' yet CM2012 was still able to deploy. I did notice that it took about 30 min vs 5. I force a machine policy update yet it still took a long time. and I did the force 4 times.
It's always worth looking at the log files as you send something out so you can track it in real time.
for packages have a look at execmgr.log on the client.
I just snapped a Win 7 VM back to build day and had a look at the path info.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\Remember some applications add their own data to the path though.
It's always worth looking at the log files as you send something out so you can track it in real time.
for packages have a look at execmgr.log on the client.
I just snapped a Win 7 VM back to build day and had a look at the path info.
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\Remember some applications add their own data to the path though.
Script ,yes ,it doesn't required but i meant was the cmd line instead of script.You don't require the path if you are specifying the full path manually via your script.