Jump to content


jblackburn

sccm client not running powershell script on some machines

Recommended Posts

I'm getting an error back on around 20% of clients failing to run scripts.

When my script runs that is part of an advert I get an error in execmgr.log listing error

"Invalid executable file powershell"

The exact same script is working on 80% of machines!! I am currently on Windows 10 generally build 1703 but the issue happens on build 1709 as well. If I rebuild the machine I get no issues the scripts run on the same machine. I'm trying to figure out the cause so I don't need to reimage the whole machine just because it won't run a powershell script. My sccm is on the latest 1803 and the clients are updating correctly showing the latest version

I am using the following command to execute the script

powershell -executionPolicy unrestricted -noexit -file ".\filename"

Execmgr give the following as an example.

Executing program powershell -executionPolicy unrestricted -noexit -file ".\DeleteWindowsOld.ps1" in --Admin context execmgr 18/04/2018 16:08:55 8240 (0x2030)
Execution Request for advert HWA20032 package HWA00059 program CleanMgr state change from --Ready to NotifyExecution execmgr 18/04/2018 16:08:55 8240 (0x2030)
Raising client SDK event for class CCM_Program, instance -----CCM_Program.PackageID="HWA00059",ProgramID="CleanMgr", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 18/04/2018 16:08:55 8240 (0x2030)
Checking content location C:\Windows\ccmcache\5 for use execmgr 18/04/2018 16:08:55 8240 (0x2030)
Successfully selected content location C:\Windows\ccmcache\5 execmgr 18/04/2018 16:08:55 8240 (0x2030)
Executing program as a script execmgr 18/04/2018 16:08:55 8240 (0x2030)
Invalid executable file powershell execmgr 18/04/2018 16:08:55 8240 (0x2030)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramBadEnvironmentEvent
{
 AdvertisementId = "HWA20032";
 ClientID = "GUID:ADC31248-103F-4445-B66C-6E7F874719AB";
 CommandLine = "powershell -executionPolicy unrestricted -noexit -file \".\\DeleteWindowsOld.ps1\"";
 DateTime = "20180418150855.412000+000";
 DriveLetter = "";
 MachineName = "TL-1004";
 PackageName = "HWA00059";
 ProcessID = 5776;
 ProgramName = "CleanMgr";
 SiteCode = "HWA";
 ThreadID = 8240;
 Win32ErrorCode = 2147942402;
 WorkingDirectory = "";
};
 execmgr 18/04/2018 16:08:55 8240 (0x2030)
Raised Program Bad Environment Event for Ad:HWA20032, Package:HWA00059, Program: CleanMgr execmgr 18/04/2018 16:08:55 8240 (0x2030)
EnterRsRuningState failed to run script powershell -executionPolicy unrestricted -noexit -file ".\DeleteWindowsOld.ps1" 0x87d01106 execmgr 18/04/2018 16:08:55 8240 (0x2030)
Fatal error 0x87d01106 enountered for program CleanMgr. This program will not retry. execmgr 18/04/2018 16:08:55 8240 (0x2030)
Requesting MTC to delete task with id: {7A861C8B-7075-426A-A3C8-8781FE53AEBA} execmgr 18/04/2018 16:08:55 8240 (0x2030)

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.