Hi!
I would like to remotely Evaluate Machine policy via powershell! I can see in the WMI-tool that the class SMS_CLIENT in namespace "root\ccm" has a method called "EvaluateMachinePolicy".
But i cant see that method in powershell!
theoretically this command should work:
(gwmi -Namespace "root\ccm" -Class sms_client).EvaluateMachinePolicy
But it does not and if i look wich methods there are i get this
PS C:\> (gwmi -Namespace "root\ccm" -Class sms_client) | gm TypeName: System.Management.ManagementObject#ROOT\ccm\SMS_Client Name MemberType Definition ---- ---------- ---------- PSComputerName AliasProperty PSComputerName = __SERVER AllowLocalAdminOverride Property bool AllowLocalAdminOverride {get;set;} ClientType Property uint32 ClientType {get;set;} ClientVersion Property string ClientVersion {get;set;} EnableAutoAssignment Property bool EnableAutoAssignment {get;set;} __CLASS Property string __CLASS {get;set;} __DERIVATION Property string[] __DERIVATION {get;set;} __DYNASTY Property string __DYNASTY {get;set;} __GENUS Property int __GENUS {get;set;} __NAMESPACE Property string __NAMESPACE {get;set;} __PATH Property string __PATH {get;set;} __PROPERTY_COUNT Property int __PROPERTY_COUNT {get;set;} __RELPATH Property string __RELPATH {get;set;} __SERVER Property string __SERVER {get;set;} __SUPERCLASS Property string __SUPERCLASS {get;set;} ConvertFromDateTime ScriptMethod System.Object ConvertFromDateTime(); ConvertToDateTime ScriptMethod System.Object ConvertToDateTime();
Why oh why? I get it to work with a VB-script that looks like this:
On Error Resume Next CompName="." Set WShell = CreateObject("WScript.Shell") Set smsClient = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_ CompName & "\root\ccm:SMS_Client") smsClient.RequestMachinePolicy smsclient.EvaluateMachinePolicy
Please help!
// Mr Clint Eastwood