0
The goal is to make XML/SOAP/WSMan request from Python and Linux and set time on remote Windows 10 machine.
I can do that via CMD, PowerShell or Cygwin/SSH but I need fast native way. I'm doing a lot via WMI, it's simpler and faster.
I try to invoke Win32_OperatingSystem.SetDateTime
.
SOAP/WSMan response conatains: The SOAP XML in the message does not match the corresponding XML schema definition. Change the XML and retry. (extended fault data: {u'fault_subcode': 'w:SchemaValidationError', u'fault_code': 's:Sender', u'wsmanfault_code': '2150858817', 'transport_message': u'Bad HTTP response returned from server. Code 500', 'http_status_code': 500})
I tried to accomplish similar task manually on both local and remote machines. Results are same.
Via WMIC:
C:\Users\Administrator>wmic /node:10.254.251.2 os call SetDateTime 20180517141043.945000+000
Executing (Win32_OperatingSystem)->SetDateTime()
ERROR:
Description = Invalid method Parameter(s)
Via WinRM:
C:\Users\Administrator>winrm invoke SetDateTime wmicimv2/Win32_OperatingSystem @{LocalDateTime="20170505080808.123123+120"}
WSManFault
Message
ProviderFault
WSManFault
Message = The WS-Management service cannot process the request. The element for a datetime value must have exactly one child and no mixed content.
Error number: -2144108479 0x80338041
The SOAP XML in the message does not match the corresponding XML schema definition. Change the XML and retry.
Via PowerShell's WMI cmdlets:
PS C:\Users\Administrator> Invoke-WmiMethod -Class Win32_OperatingSystem -Name SetDateTime -ArgumentList '20180517133310.323710+000' -ComputerName 10.254.251.2
Invoke-WmiMethod : Invalid method Parameter(s)
At line:1 char:1
+ Invoke-WmiMethod -Class Win32_OperatingSystem -Name SetDateTime -Argu ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [Invoke-WmiMethod], ManagementException
+ FullyQualifiedErrorId : InvokeWMIManagementException,Microsoft.PowerShell.Commands.InvokeWmiMethod
If I change string format, I get Type Error
. Only with this format, which seems to be correct, I get Invalid method Parameter(s)
.
Also I get Invalid method Parameter(s)
when executing from WBEMTest
.
I explored method types with WBEMTest
. Parameter type is CIM_DATETIME
. What's wrong with it? How do I change time on remote machine?
How do I set time via WMI?
What's the "corresponding schema definition" and how do I obtain it?
Apparently, two differences are
/node
argument andwhere(1)
clause. When I get back to this project, I'll definitely check both. Thanks. – George Sovetov – 2018-07-28T16:33:28.803