dayhkr has asked for the wisdom of the Perl Monks concerning the following question:

I have been working on a script to move our SCCM clients over to our new SCCM server this involves setting the site ID which is pretty easy then through WMI call a Policy update is triggered. I originally tried this through Powershell which didn't work out for various reason. I have since come back to my roots and began coding this script in Perl I have most of the calls working but can't figure out how to convert the Powershell WMI call over to a Perl Win32::OLE WMI call. Below is the Powershell WMI call to the WMI repo. I am hoping someone can help me figure out how I would do this in Perl to trigger the SCCM policy update. Many thanks in advance as this has been 3 long days trying to get it to work.

Powershell code:
$SMSCli = [wmiclass] "\\$computer\root\ccm:sms_client" $SMSCli.TriggerSchedule("{00000000-0000-0000-0000-000000000003}")

I have queried the WMI repository before and I have even created a process through it but I don't understand in Perl how to set this value to cause an machine policy update. I would appreciate any help as I would like to use Perl to flip all 2000 devices with out the program choking on bad SCCM clients like Powershell does.

Replies are listed 'Best First'.
Re: WMI SCCM TriggerSchedule
by Anonymous Monk on Nov 20, 2014 at 22:54 UTC

    In case anyone comes here from google, here's the sub you need:

    sub ScheduleUpdateScan { my $Host = shift; my $SoftwareUpdateScan = "{00000000-0000-0000-0000-000000000113}"; my $CCM = Win32::OLE->GetObject("winmgmts:{impersonationLevel=impers +onate,authenticationLevel=pktPrivacy}//$Host\\root\\ccm:sms_client") +or warn Win32::OLE->LastError() and return 0; $CCM->TriggerSchedule($SoftwareUpdateScan) or warn Win32::OLE->LastE +rror() and return 0; return 1; }