Do you happen to have quotes around the entire command line in your program?  
It's not executing powershell.exe...it looks like it's trying to execute a PS 
script named "Powershell.exe -executionpolicy Bypass -file .\remove_qt.ps1" as 
a script (hence the line "Executing program as a script due to file 
association").

Double check your double quotes.

-Phil
_________________________________________________________________
Phil Schwan | Technical Architect, Enterprise Windows Services
Microsoft VTSP (b-phs...@microsoft.com<mailto:b-phs...@microsoft.com>)
Project Leadership Associates | 2000 Town Center, Suite 1900, Southfield, MI 
48075
Lync: 312.756.1626  Mobile: 419.262.5133
[speaker2]<http://mmsmoa.com/>[linkedin_logo-19x20]<http://www.linkedin.com/in/philschwan>[Twitter-Logo1-20x20]<https://twitter.com/philschwan>
 [wordpress-logo3] <http://lab-geek.com/>



From: listsadmin@lists.myitforum.com [mailto:listsadmin@lists.myitforum.com] On 
Behalf Of Murray, Mike
Sent: Friday, April 15, 2016 2:11 PM
To: ms...@lists.myitforum.com
Subject: [mssms] Problem with package running PowerShell script

I must be missing something simple here. I have a package with a program that 
runs a PowerShell script to remove QuickTime. I've tested the script, it works 
fine. I ran it from the command line as specified below and it worked.

Powershell.exe -executionpolicy Bypass -file .\remove_qt.ps1

But, when I deploy the package, I get the following in execmgr.log:

Executing program "Powershell.exe -executionpolicy Bypass -file 
.\remove_qt.ps1" in Admin context        execmgr                4/15/2016 
10:35:49 AM 5192 (0x1448)
Execution Request for advert CMC2008D package CMC002D6 program Uninstall 
QuickTime state change from Ready to NotifyExecution          execmgr           
   4/15/2016 10:35:49 AM 5192 (0x1448)
Raising client SDK event for class CCM_Program, instance 
CCM_Program.PackageID="CMC002D6",ProgramID="Uninstall QuickTime", actionType 
1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l          
execmgr              4/15/2016 10:35:49 AM 5192 (0x1448)
Checking content location C:\WINDOWS\ccmcache\y for use      execmgr            
  4/15/2016 10:35:50 AM 5192 (0x1448)
Successfully selected content location C:\WINDOWS\ccmcache\y              
execmgr              4/15/2016 10:35:50 AM 5192 (0x1448)
Executing program as a script due to file association         execmgr           
   4/15/2016 10:35:50 AM 5192 (0x1448)
Invalid data file "Powershell.exe -executionpolicy Bypass -file 
.\remove_qt.ps1" to execute using file association                execmgr       
       4/15/2016 10:35:50 AM 5192 (0x1448)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramBadEnvironmentEvent
{
                AdvertisementId = "CMC2008D";
                ClientID = "GUID:5695ee49-00d7-4e49-814c-2bc705c3819f";
                CommandLine = "\"Powershell.exe -executionpolicy Bypass -file 
.\\remove_qt.ps1\"";
                DateTime = "20160415173550.115000+000";
                DriveLetter = "";
                MachineName = "V-S52477-W7D";
                PackageName = "CMC002D6";
                ProcessID = 3680;
                ProgramName = "Uninstall QuickTime";
                SiteCode = "CMC";
                ThreadID = 5192;
                Win32ErrorCode = 2147942402;
                WorkingDirectory = "";
};
                execmgr              4/15/2016 10:35:50 AM 5192 (0x1448)
Raised Program Bad Environment Event for Ad:CMC2008D, Package:CMC002D6, 
Program: Uninstall QuickTime                execmgr              4/15/2016 
10:35:50 AM 5192 (0x1448)
EnterRsRuningState failed to run script "Powershell.exe -executionpolicy Bypass 
-file .\remove_qt.ps1" 0x87d01106                execmgr              4/15/2016 
10:35:50 AM 5192 (0x1448)
Fatal error 0x87d01106 enountered for program Uninstall QuickTime. This program 
will not retry.              execmgr                4/15/2016 10:35:50 AM 5192 
(0x1448)



Best Regards,

Mike Murray
Desktop Management Coordinator - IT Support Services
California State University, Chico
530.898.4357
mmur...@csuchico.edu<mailto:mmur...@csuchico.edu>





Reply via email to