Deployment of a Command line?

Duchemin, Dominique 2,006 Reputation points
2022-09-30T03:13:14.987+00:00

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
246304-2022-09-29-18-55-52-script-branch-01.png

246335-2022-09-29-20-20-26-script-branch-03.png

but the distribution error out:
246229-2022-09-29-18-53-03-script-disable-branch-cache-mo.png

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

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,362 questions
Microsoft Configuration Manager Updates
Microsoft Configuration Manager Updates
Microsoft Configuration Manager: An integrated solution for for managing large groups of personal computers and servers.Updates: Broadly released fixes addressing specific issue(s) or related bug(s). Updates may also include new or modified features (i.e. changing default behavior).
962 questions
0 comments No comments
{count} votes

8 answers

Sort by: Most helpful
  1. Pavel yannara Mirochnitchenko 11,711 Reputation points
    2022-09-30T05:42:29.223+00:00

    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 :)

    1 person found this answer helpful.
    0 comments No comments

  2. 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.

    1 person found this answer helpful.
    0 comments No comments

  3. 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...

    1. the feature is not disabled!!! it should be unchecked !!! Why?
      246361-2022-09-29-21-43-03-brachcache-feature-enabled.png
    2. the service is disabled and not running
      246259-2022-09-29-21-43-52-branchcache-service-disabled.png

    Thanks,
    Dom

    0 comments No comments

  4. 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

    0 comments No comments

  5. Duchemin, Dominique 2,006 Reputation points
    2022-09-30T23:28:56.203+00:00

    Hello,

    If I run this script in CM:

    246665-2022-10-01-13-35-57-script-01.png
    246548-2022-10-01-13-37-53-script-02.png
    Stop the BranchCache Service
    sc stop "PeerDistSvc"

    Disable the BranchCach Service
    sc config "PeerDistSvc" start= disabled

    Disable the BranchCache Feature
    Dism /online /Disable-Feature /FeatureName:peerdist /NoRestart

    Only the feature is processed and Disabled!!

    If I do

    Disable the BranchCache Feature
    Dism /online /Disable-Feature /FeatureName:peerdist /NoRestart

    Stop the BranchCache Service
    sc stop "PeerDistSvc"

    Disable the BranchCach Service
    sc config "PeerDistSvc" start= disabled

    Only 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

    0 comments No comments