Displaying Client Component Software Update Properties

Modified from https://blogs.msdn.microsoft.com/fei_xias_blog/2013/10/20/system-center-2012-configmgr-using-vbs-to-extend-the-dcm-script-execution-timeout-value/

Save as DisplaySUClientCompProps.vbs

On Error Resume Next

‘***  Define string variables

Class_Name =   “SMS_SCI_ClientComp”
Class_ItemName = “Software Updates”
Class_ItemType = “Client Component”

‘***  Check parameters – we need the provider server name and the site code

set args=wscript.arguments

If args.Count = 2 then
SMSProviderServer = UCASE(Wscript.Arguments(0))
SiteCode = UCASE(Wscript.Arguments(1))
Else
wscript.Echo “Incorrect command line arguments.” & vbCrLf & “Usage: cscript /nologo DisplaySUClientCompProps.vbs <smsproviderserver> <sitecode>” & vbCrLf & “Example: cscript /nologo DisplaySUClientCompProps.vbs SERVER1 S01” & vbCrLf
WScript.Quit(1)
End If

‘***  Connect to the provider – report the error and terminate on failure

SMSProviderServer = “\\” + SMSProviderServer + “\”
Set ObjSvc = GetObject(“winmgmts:” & “{impersonationLevel=Impersonate,authenticationLevel=Pkt}!” & SMSProviderServer & “root\sms\site_” & SiteCode)

If Err.Number <> 0 Then
wscript.Echo “Failed to connect to provider server with code: ” & Err.Number & “.  Aborting!”
WScript.Quit(2)
End If

‘***  Get the desired instance of the class

Set objInst = ObjSvc.Get(Class_Name & “.ItemName='” & Class_ItemName & “‘,ItemType='” & Class_ItemType & “‘,SiteCode='” & SiteCode &”‘”)

If Err.Number <> 0 Then
WScript.Echo “Failed to open desired object with error code ” & Err.Number & ” (” & Err.Description & “).  Aborting!”
WScript.Quit(3)
End If

For Each objProp in objInst.Props
WScript.Echo “Property ‘” & objProp.PropertyName & “‘ found with value ‘” & objProp.Value & “‘.”
Next

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s