Isnt't there group policy or reg keys for that? Also if you transfer this to Powershell, you could deploy just a powershell script. The .bat solution is the last one here I would use :)
Deployment of a Command line?
Hello,
I am trying to
Disable the feature BranchCache (PeerDist)
Disable and Stop the service associated witn: PeerDistSvc
I create a bat file
BranchCache.bat
Dism /online /Disable-Feature /FeatureName:peerdist /NoRestart
sc config "PeerDistSvc" start= disabled
sc stop "PeerDistSvc"
I created a package and distributed it to a collection
but the distribution error out:
On the client I have the execmgr.log:
Executing program as a script execmgr 9/29/2022 7:51:13 PM 6644 (0x19F4)
Invalid executable file BranchCache.bat execmgr 9/29/2022 7:51:13 PM 6644 (0x19F4)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramBadEnvironmentEvent
{
AdvertisementId = "UCP208A0";
ClientID = "GUID:E90067B0-94BB-4AC9-982F-5ACE61FB41DC";
CommandLine = "BranchCache.bat";
DateTime = "20220930025113.003000+000";
DriveLetter = "";
MachineName = "VIPSCCMDP02";
PackageName = "UCP00DA9";
ProcessID = 6420;
ProgramName = "ISS - Servers - Disabling the service Branch Cache";
SiteCode = "UCP";
ThreadID = 6644;
Win32ErrorCode = 2147942402;
WorkingDirectory = "";
};
execmgr 9/29/2022 7:51:13 PM 6644 (0x19F4)
Raised Program Bad Environment Event for Ad:UCP208A0, Package:UCP00DA9, Program: ISS - Servers - Disabling the service Branch Cache execmgr 9/29/2022 7:51:13 PM 6644 (0x19F4)
EnterRsRuningState failed to run script BranchCache.bat 0x87d01106 execmgr 9/29/2022 7:51:13 PM 6644 (0x19F4)
Fatal error 0x87d01106 enountered for program ISS - Servers - Disabling the service Branch Cache. This program will not retry. execmgr 9/29/2022 7:51:13 PM 6644 (0x19F4)
=================================================================
second run changing the path to \ServerName\SCCm\Scripts
..............................................................................................................................
Checking UNC path \VRPSCCMPR01\SCCM\scripts for access execmgr 9/29/2022 9:00:52 PM 4720 (0x1270)
IsNetResourceAccessible failed with error code 0x00000003 execmgr 9/29/2022 9:00:52 PM 4720 (0x1270)
================================================================
Then trying \ServerName\sms_ucp\scripts
.........................................................................................
Checking UNC path \VRPSCCMPR01\sms_ucp\scripts for access execmgr 9/29/2022 9:14:22 PM 4720 (0x1270)
IsNetResourceAccessible failed with error code 0x00000005 execmgr 9/29/2022 9:14:22 PM 4720 (0x1270)
Checking this new error...
Thanks,
Dom
8 answers
Sort by: Most helpful
-
Pavel yannara Mirochnitchenko 11,711 Reputation points
2022-09-30T05:42:29.223+00:00 -
Pavel yannara Mirochnitchenko 11,711 Reputation points
2022-10-02T17:42:01.927+00:00 Did you check afterwards, that those services were actually stopped? Your commands were correct, I checked them myself.
-
Duchemin, Dominique 2,006 Reputation points
2022-09-30T04:38:40.587+00:00 Hello,
After findings a folder properly shared the execmgr.log looks better:
Policy deleted for advertisement UCP208A2 package UCP00DA9 program ISS - Servers - Disabling the service Branch Cache execmgr 9/29/2022 9:34:47 PM 7096 (0x1BB8)
Policy was deleted or expired for program ISS - Servers - Disabling the service Branch Cache. Remove the execution request. execmgr 9/29/2022 9:34:47 PM 7096 (0x1BB8)
Requesting MTC to delete task with id: {CD34A8FB-1552-44BE-AD81-CBC392CC337C} execmgr 9/29/2022 9:34:47 PM 7096 (0x1BB8)
This execution request does not have a corresponding task in MTC. execmgr 9/29/2022 9:34:47 PM 7096 (0x1BB8)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 45l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:34:47 PM 7096 (0x1BB8)
This machine is not a workstation, returning false for MDMIsExternallyManaged. execmgr 9/29/2022 9:34:59 PM 6556 (0x199C)
Not RS3+, this device is SCCM managed. execmgr 9/29/2022 9:34:59 PM 6556 (0x199C)
This machine is not a workstation, returning false for MDMIsExternallyManaged. execmgr 9/29/2022 9:34:59 PM 4720 (0x1270)
Not RS3+, this device is SCCM managed. execmgr 9/29/2022 9:34:59 PM 4720 (0x1270)
Policy arrived for parent package UCP00DA9 program ISS - Servers - Disabling the service Branch Cache execmgr 9/29/2022 9:34:59 PM 4720 (0x1270)
Mandatory execution requested for program ISS - Servers - Disabling the service Branch Cache and advertisement UCP208A3 execmgr 9/29/2022 9:34:59 PM 5664 (0x1620)
Creating mandatory request for advert UCP208A3, program ISS - Servers - Disabling the service Branch Cache, package UCP00DA9 execmgr 9/29/2022 9:34:59 PM 5664 (0x1620)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 6l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
This machine is not a workstation, returning false for MDMIsExternallyManaged. execmgr 9/29/2022 9:35:00 PM 5664 (0x1620)
Not RS3+, this device is SCCM managed. execmgr 9/29/2022 9:35:00 PM 5664 (0x1620)
An existing MTC token was not supplied, using ExecutionRequest's Id as MTC token and this execution request is the owner of resultant MTC task. execmgr 9/29/2022 9:35:00 PM 5664 (0x1620)
Request a MTC task for execution request of package UCP00DA9, program ISS - Servers - Disabling the service Branch Cache with request id: {D7A4726B-0DDE-4FDF-939D-461BA4BD5B0C} execmgr 9/29/2022 9:35:00 PM 5664 (0x1620)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramOfferReceivedEvent
{
AdvertisementId = "UCP208A3";
ClientID = "GUID:E90067B0-94BB-4AC9-982F-5ACE61FB41DC";
DateTime = "20220930043500.019000+000";
MachineName = "VIPSCCMDP02";
ProcessID = 6420;
SiteCode = "UCP";
ThreadID = 4720;
};
execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Execution Request for advert UCP208A3 package UCP00DA9 program ISS - Servers - Disabling the service Branch Cache state change from NotExist to Ready execmgr 9/29/2022 9:35:00 PM 5664 (0x1620)
MTC task with id {D7A4726B-0DDE-4FDF-939D-461BA4BD5B0C}, changed state from 0 to 4 execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:00 PM 5664 (0x1620)
This machine is not a workstation, returning false for MDMIsExternallyManaged. execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Not RS3+, this device is SCCM managed. execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
MTC signaled SWD execution request with program id: ISS - Servers - Disabling the service Branch Cache, package id: UCP00DA9 for execution. execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Sending ack to MTC for task with id: {D7A4726B-0DDE-4FDF-939D-461BA4BD5B0C} execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Executing program BranchCache.bat in Admin context execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Execution Request for advert UCP208A3 package UCP00DA9 program ISS - Servers - Disabling the service Branch Cache state change from Ready to NotifyExecution execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Checking UNC path \VRPSCCMPR01\Source\Application\Scripts for access execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Network UNC path \VRPSCCMPR01\Source\Application\Scripts is accessible execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Executing program as a script execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Successfully prepared command line "\VRPSCCMPR01\Source\Application\Scripts\BranchCache.bat" execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Command line = "\VRPSCCMPR01\Source\Application\Scripts\BranchCache.bat", Working Directory = \VRPSCCMPR01\Source\Application\Scripts\ execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Running "\VRPSCCMPR01\Source\Application\Scripts\BranchCache.bat" with 32bitLauncher execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Created Process for the passed command line execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramStartedEvent
{
AdvertisementId = "UCP208A3";
ClientID = "GUID:E90067B0-94BB-4AC9-982F-5ACE61FB41DC";
CommandLine = ""\\VRPSCCMPR01\Source\Application\Scripts\BranchCache.bat"";
DateTime = "20220930043500.661000+000";
MachineName = "VIPSCCMDP02";
PackageName = "UCP00DA9";
ProcessID = 6420;
ProgramName = "ISS - Servers - Disabling the service Branch Cache";
SiteCode = "UCP";
ThreadID = 4720;
UserContext = "NT AUTHORITY\SYSTEM";
WorkingDirectory = "\\VRPSCCMPR01\Source\Application\Scripts\";
};
execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Raised Program Started Event for Ad:UCP208A3, Package:UCP00DA9, Program: ISS - Servers - Disabling the service Branch Cache execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 1l, value NULL, user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
EvaluateRequestForExecution - Updated current running request execmgr 9/29/2022 9:35:00 PM 4720 (0x1270)
MTC task with id {D7A4726B-0DDE-4FDF-939D-461BA4BD5B0C}, changed state from 4 to 5 execmgr 9/29/2022 9:35:00 PM 7096 (0x1BB8)
Program exit code 0 execmgr 9/29/2022 9:35:01 PM 5664 (0x1620)
Looking for MIF file to get program status execmgr 9/29/2022 9:35:01 PM 5664 (0x1620)
Script for Package:UCP00DA9, Program: ISS - Servers - Disabling the service Branch Cache succeeded with exit code 0 execmgr 9/29/2022 9:35:01 PM 5664 (0x1620)
Raising event:
[SMS_CodePage(437), SMS_LocaleID(1033)]
instance of SoftDistProgramCompletedSuccessfullyEvent
{
AdvertisementId = "UCP208A3";
ClientID = "GUID:E90067B0-94BB-4AC9-982F-5ACE61FB41DC";
DateTime = "20220930043501.130000+000";
MachineName = "VIPSCCMDP02";
PackageName = "UCP00DA9";
ProcessID = 6420;
ProgramName = "ISS - Servers - Disabling the service Branch Cache";
SiteCode = "UCP";
ThreadID = 5664;
UserContext = "NT AUTHORITY\SYSTEM";
};
execmgr 9/29/2022 9:35:01 PM 5664 (0x1620)
Raised Program Success Event for Ad:UCP208A3, Package:UCP00DA9, Program: ISS - Servers - Disabling the service Branch Cache execmgr 9/29/2022 9:35:01 PM 5664 (0x1620)
Execution is complete for program ISS - Servers - Disabling the service Branch Cache. The exit code is 0, the execution status is Success execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)
This machine is not a workstation, returning false for MDMIsExternallyManaged. execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)
Not RS3+, this device is SCCM managed. execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 10l, value Result:TRUE ,SDKCallerId:, user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)
Requesting MTC to delete task with id: {D7A4726B-0DDE-4FDF-939D-461BA4BD5B0C} execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)
MTC task with id: {D7A4726B-0DDE-4FDF-939D-461BA4BD5B0C} deleted successfully. execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)
Raising client SDK event for class CCM_Program, instance CCM_Program.PackageID="UCP00DA9",ProgramID="ISS - Servers - Disabling the service Branch Cache", actionType 1l, value , user NULL, session 4294967295l, level 0l, verbosity 30l execmgr 9/29/2022 9:35:01 PM 4016 (0x0FB0)---------------------------------------------------------------------------------------------------------------
now checking the execution of the batch on the client...
- the feature is not disabled!!! it should be unchecked !!! Why?
- the service is disabled and not running
Thanks,
Dom - the feature is not disabled!!! it should be unchecked !!! Why?
-
Duchemin, Dominique 2,006 Reputation points
2022-09-30T16:04:46.163+00:00 Hello,
Between the command in bat and the command in powershell is there any changes?
The command on both methods (bat & ps) work perfectly when run locally on the machines.
The issue remains for both when the script is sent through a package from Configuration Manager as the disabling works on the service (SC) but not on the feature (DISM) ...Anything special to know about DISM when used with Configuration Manager?
Thanks,
Dom -
Duchemin, Dominique 2,006 Reputation points
2022-09-30T23:28:56.203+00:00 Hello,
If I run this script in CM:
Stop the BranchCache Service
sc stop "PeerDistSvc"Disable the BranchCach Service
sc config "PeerDistSvc" start= disabledDisable the BranchCache Feature
Dism /online /Disable-Feature /FeatureName:peerdist /NoRestartOnly the feature is processed and Disabled!!
If I do
Disable the BranchCache Feature
Dism /online /Disable-Feature /FeatureName:peerdist /NoRestartStop the BranchCache Service
sc stop "PeerDistSvc"Disable the BranchCach Service
sc config "PeerDistSvc" start= disabledOnly the service is stopped and disabled!!!
Any idea?
Which logs will show the script execution ?
on the clients C:\Windows\CCM\Logs\Script.log
First machine:
Same logs as per below...
Second machine:
Parsing the Script Execution Message ... Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Script Guid: 793E2E62-5C3B-4EAA-BDAF-68672778D47C Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Run the PowerShell Script: [793E2E62-5C3B-4EAA-BDAF-68672778D47C] Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
PowerShell path: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Launching the PowerShell.exe for Script [793E2E62-5C3B-4EAA-BDAF-68672778D47C] Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Creating the task object... Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Executing the task... Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Started script handler job. Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Execution task is kicked off. Scripts 10/1/2022 1:32:42 PM 4368 (0x1110)
Running PS script... Scripts 10/1/2022 1:32:42 PM 5504 (0x1580)
Creating state message... Scripts 10/1/2022 1:32:43 PM 5504 (0x1580)
Sending script state message (fast): {1346EBF9-FE1B-4343-A763-51D47EDC952A} Scripts 10/1/2022 1:32:43 PM 5504 (0x1580)
Result are sent for ScriptGuid: 793E2E62-5C3B-4EAA-BDAF-68672778D47C and TaskID: {1346EBF9-FE1B-4343-A763-51D47EDC952A} Scripts 10/1/2022 1:32:43 PM 5504 (0x1580)
Parsing the Script Execution Message ... Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Script Guid: 6BDD0AA6-3DBA-4664-B349-69B4671F04AB Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Run the PowerShell Script: [6BDD0AA6-3DBA-4664-B349-69B4671F04AB] Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
PowerShell path: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Launching the PowerShell.exe for Script [6BDD0AA6-3DBA-4664-B349-69B4671F04AB] Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Creating the task object... Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Executing the task... Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Started script handler job. Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Execution task is kicked off. Scripts 10/1/2022 1:43:15 PM 5504 (0x1580)
Running PS script... Scripts 10/1/2022 1:43:15 PM 1352 (0x0548)
Creating state message... Scripts 10/1/2022 1:43:22 PM 1352 (0x0548)
Sending script state message (fast): {729A4F53-FB47-45E4-A4D1-9E39C4190544} Scripts 10/1/2022 1:43:22 PM 1352 (0x0548)
Result are sent for ScriptGuid: 6BDD0AA6-3DBA-4664-B349-69B4671F04AB and TaskID: {729A4F53-FB47-45E4-A4D1-9E39C4190544} Scripts 10/1/2022 1:43:22 PM 1352 (0x0548)
Parsing the Script Execution Message ... Scripts 10/1/2022 1:50:08 PM 4368 (0x1110)
Script Guid: 793E2E62-5C3B-4EAA-BDAF-68672778D47C Scripts 10/1/2022 1:50:08 PM 4368 (0x1110)
UpdateURLWithTransportSettings(): OLD URL - https://VRPSCCMPR01.ad/SMS_MP Scripts 10/1/2022 1:50:08 PM 4368 (0x1110)
UpdateURLWithTransportSettings(): NEW URL - https://VRPSCCMPR01.ad:443/SMS_MP Scripts 10/1/2022 1:50:08 PM 4368 (0x1110)
Run the PowerShell Script: [793E2E62-5C3B-4EAA-BDAF-68672778D47C] Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
PowerShell path: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell.exe Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
Launching the PowerShell.exe for Script [793E2E62-5C3B-4EAA-BDAF-68672778D47C] Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
Creating the task object... Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
Executing the task... Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
Started script handler job. Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
Execution task is kicked off. Scripts 10/1/2022 1:50:09 PM 1252 (0x04E4)
Running PS script... Scripts 10/1/2022 1:50:09 PM 4368 (0x1110)
Creating state message... Scripts 10/1/2022 1:50:10 PM 4368 (0x1110)
Sending script state message (fast): {EC9C8D76-9DE2-4257-B827-D79D15036560} Scripts 10/1/2022 1:50:10 PM 4368 (0x1110)
Result are sent for ScriptGuid: 793E2E62-5C3B-4EAA-BDAF-68672778D47C and TaskID: {EC9C8D76-9DE2-4257-B827-D79D15036560} Scripts 10/1/2022 1:50:10 PM 4368 (0x1110)Thanks,
Dom