I am running below script on my system to perform all sccm client actions trigger and getting below error.
Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error message : The WS-Management service cannot process the request. The service is
configured to not accept any remote shell requests. For more information, see the about_Remote_Troubleshooting Help topic.
At line:60 char:2
+ Run-SCCMClientAction -Computername $env:COMPUTERNAME -ClientAction A ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Run-SCCMClientAction
Function Run-SCCMClientAction {
[CmdletBinding()]
# Parameters used in this function
param
(
[Parameter(Position=0, Mandatory = $True, HelpMessage="Provide PC names", ValueFromPipeline = $true)]
[string[]]$Computername,
[ValidateSet('MachinePolicy',
'DiscoveryData',
'ComplianceEvaluation',
'AppDeployment',
'HardwareInventory',
'UpdateDeployment',
'UpdateScan',
'SoftwareInventory')]
[string[]]$ClientAction
)
$ActionResults = @()
Try {
$ActionResults = Invoke-Command -ComputerName $Computername {param($ClientAction)
Foreach ($Item in $ClientAction) {
$Object = @{} | select "Action name",Status
Try{
$ScheduleIDMappings = @{
'MachinePolicy' = '{00000000-0000-0000-0000-000000000021}';
'DiscoveryData' = '{00000000-0000-0000-0000-000000000003}';
'ComplianceEvaluation' = '{00000000-0000-0000-0000-000000000071}';
'AppDeployment' = '{00000000-0000-0000-0000-000000000121}';
'HardwareInventory' = '{00000000-0000-0000-0000-000000000001}';
'UpdateDeployment' = '{00000000-0000-0000-0000-000000000108}';
'UpdateScan' = '{00000000-0000-0000-0000-000000000113}';
'SoftwareInventory' = '{00000000-0000-0000-0000-000000000002}';
}
$ScheduleID = $ScheduleIDMappings[$item]
Write-Verbose "Processing $Item - $ScheduleID"
[void]([wmiclass] "root\ccm:SMS_Client").TriggerSchedule($ScheduleID);
$Status = "Success"
Write-Verbose "Operation status - $status"
}
Catch{
$Status = "Failed"
Write-Verbose "Operation status - $status"
}
$Object."Action name" = $item
$Object.Status = $Status
$Object
}
} -ArgumentList $ClientAction -ErrorAction Stop | Select-Object @{n='PCName';e={$_.pscomputername}},"Action name",Status
}
Catch{
Write-Error $_.Exception.Message
}
Return $ActionResults
}
Run-SCCMClientAction -Computername $env:COMPUTERNAME -ClientAction AppDeployment
Enable-PSRemoting -Force;
and then try to run the remote SCCM stuff against it. If that works, that's what you need. Look into setting GPOs to configure on lots of machines/servers at large scale. Otherwise, you might to ensure there are no restriction set based on IP subnet(s), etc. in another configuration hopefully the command and your testing you get lucky and that's the solution. Let me know how it goes.Try{}
command$ActionResults = Invoke-Command -ComputerName $Computername
becauseInvoke-Command
needs to be able to remotely access PowerShell as far as I know.