Hi,
Came upon this recently was trying to get it to work for me. I ran "powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File .\filename.ps1" at the command line but have trouble running it from sccm 2007.
The package consists of 2 programs one being the uninstall of Symnatec Endpoint and an installation of Checkpoint endpoint. Checkpoint Endpoint has been check to "run another program first" being the uninstallation of Symantec.
I have entered the following in the command line field for the uninstall program: powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File .\RemoveSoftware.ps1 and I place the the RemoveSoftware.ps1 in the package source directory.
I pretty new to sccm so I must have done something wrong.
The error log file at the client is:
<![LOG[Successfully selected content location C:\Windows\system32\CCM\Cache\001005C3.9.System]LOG]!><time="14:09:35.735+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="executioncontext.cpp:1703">
<![LOG[GetFileVersionInfoSize failed for file C:\Windows\system32\CCM\Cache\001005C3.9.System\powershell.exe, error 2]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="2" thread="2908" file="executioncontext.cpp:119">
<![LOG[CProgramExecution::CProgramExecution]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="programexecution.cpp:24">
<![LOG[Executing program as a script]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="executionengine.cpp:103">
<![LOG[File C:\Windows\system32\CCM\Cache\001005C3.9.System\powershell.exe is not a valid executable file]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="3" thread="2908" file="execengnutility.cpp:173">
<![LOG[File C:\Windows\system32\CCM\Cache\001005C3.9.System\powershell.exe is not a valid executable file]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="3" thread="2908" file="execengnutility.cpp:173">
<![LOG[Found executable file powershell.exe with complete path C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="execengnutility.cpp:264">
<![LOG[Successfully prepared command line "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File .\RemovSoftware.ps1]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="scriptexecution.cpp:523">
<![LOG[Command line = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File .\RemovSoftware.ps1, Working Directory = C:\Windows\system32\CCM\Cache\001005C3.9.System\]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="scriptexecution.cpp:284">
<![LOG[Cached CCM (user, session) is: (S-1-5-21-1942423493-1642472500-1446904402-58211,1).]LOG]!><time="14:09:35.751+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="usertoken.cpp:1138">
<![LOG[Created Process for the passed command line]LOG]!><time="14:09:35.829+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="scriptexecution.cpp:407">
<![LOG[Raising event:
[SMS_CodePage(850), SMS_LocaleID(3084)]
instance of SoftDistProgramStartedEvent
{
AdvertisementId = "001203ED";
ClientID = "GUID:4A4BB982-2FFA-4317-80EB-15FD1B32D7C1";
CommandLine = "\"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\" -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File .\\RemovSoftware.ps1";
DateTime = "20170803180935.844000+000";
MachineName = "50FZYN2";
PackageName = "001005C3";
ProcessID = 116;
ProgramName = "Uninstall Symantec";
SiteCode = "001";
ThreadID = 2908;
UserContext = "AUTORITE NT\\Système";
WorkingDirectory = "C:\\Windows\\system32\\CCM\\Cache\\001005C3.9.System\\";
};
]LOG]!><time="14:09:35.844+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="event.cpp:525">
<![LOG[Raised Program Started Event for Ad:001203ED, Package:001005C3, Program: Uninstall Symantec]LOG]!><time="14:09:35.844+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="executioncontext.cpp:523">
<![LOG[GetProcessInfo - Process creation time high = 30608515, low = 2853387312]LOG]!><time="14:09:35.844+240" date="08-03-2017" component="execmgr" context="" type="1" thread="2908" file="executioncontext.cpp:2381">
I suspect that my command line is incorrect or the file location?
Your help is appreciated.
Thanks,