3

I want to be able to check the CCM Updates Schedule as seen in Configuration Manager Updates tab. I've been looking around on google and I've not been able to find a consistent answer to this.

I tried to create a COM object using UDA.CCMUpdatesDeployment. This allows me to successfully set the recurring schedule with SetUserDefinedSchedule method. If I try to use GetUserDefinedSchedule I only get the original values of the variables.

PS> $UD = New-Object -com "UDA.CCMUpdatesDeployment"
PS> $A= 101
PS> $B= 102
PS> $UD.GetUserDefinedSchedule([ref]$A, [ref]$B)
PS> $A
101
PS> $B
102
PS> $UD.GetUserDefinedSchedule

MemberType          : Method
OverloadDefinitions : {void GetUserDefinedSchedule (Variant, Variant)}
TypeNameOfValue     : System.Management.Automation.PSMethod
Value               : void GetUserDefinedSchedule (Variant, Variant)
Name                : GetUserDefinedSchedule
IsInstance          : True

I actually want to be able to do this remotely for a list of servers in a text file but right now any way would do.

frogman
  • 31
  • 2

2 Answers2

0

So I'm a complete newbie on Powershell.

My variables should have been declared:

PS> [ref]$A = $Null
PS> [ref]$B = $Null

Then the command should have been run as:

PS> $UD.GetUserDefinedSchedule($A,$B)

Result for every Sunday at 3 AM is:

PS> $A
Value
-----
    1
PS> $B
Value
-----
    3

First variable is an index of the various options available in the drop down box. Second variable contains the time in 24 hour format. So 3 PM will give value 15.

I got the answer while browsing through some powershell code. I was thinking of pass by reference as a C function to update the same variable. I still don't understand the concept in Powershell. If I update CCM and run the command using the same variables the value does not change.

frogman
  • 31
  • 2
0

Can you give this a go? Notice the way the parameters are passed in Powershell.

$A = $null
$B = $null
$UD.GetUserDefinedSchedule ([ref]$A) ([ref]$B)
write-host "Recurrence: $A"
write-host "Hour: $B"
Bin
  • 864
  • 5
  • 15