' Delete a Console Folder
Option Explicit
Dim objSWbemLocator
Dim objSWbemServices
Dim ProviderLoc
Dim Location
Dim objFolder
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices= objSWbemLocator.ConnectServer _
("COMPUTER NAME", "root\sms")
Set ProviderLoc = objSWbemServices.InstancesOf("SMS_ProviderLocation")
For Each Location In ProviderLoc
If Location.ProviderForLocalSite = True Then
Set objSWbemServices = objSWbemLocator.ConnectServer _
(Location.Machine, "root\sms\site_" + Location.SiteCode)
End If
Next
For Each objFolder in objSWbemServices.InstancesOf("SMS_ObjectContainerNode")
if objFolder.Name="Hardware - Disk" Then
objFolder.Delete_ ' Deletes the folder - the folder items are moved back to the root node.
End IF
Next