Link to home
Start Free TrialLog in
Avatar of Jeffrey Renfroe
Jeffrey RenfroeFlag for United States of America

asked on

Converting WMI type accelerator command to one that can use credentials

Hello. I am working on a PowerShell script to trigger an SCCM baseline evaluation for a specific baseline on a remote server. I want the script to use credentials. For years, I have used the WMI type accelerator to trigger the baseline. Since credentials cannot be passed to it, I have tried others ways without success. Is it possible?

$ServerName = "Server1"
$BaselineName = "Test Baseline"
$BaselineInfo = gwmi -ComputerName $ServerName -Namespace root\ccm\dcm -Class SMS_DesiredConfiguration -Credential $creds | Where {$_.DisplayName -eq $BaselineName}

#Need to use credentials
([wmiclass]"\\$ServerName\root\ccm\dcm:SMS_DesiredConfiguration").TriggerEvaluation($BaselineInfo.Name, $BaselineInfo.Version)

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jeffrey Renfroe

ASKER

Wow. I feel foolish. I completely forgot that I ask it previously. Thank you for the reminder. This did answer my question.
Thanks again.