The remote machine I'm trying to connect to is as follows:
This is the code I'm using:
Dim remotets, objComputer, colComputereremote, strComputer
Dim objSWbemLocator, objWMIServiceremote
strComputer = "XTEMB4"
WScript.Echo strComputer
'Get remote machine WMI service object
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIServiceremote = objSWbemLocator.ConnectServer(strComputer, "root\CIMV2", "dts", _
"dts", "MS_409", "ntlmdomain:" & "")
Set colComputereremote = objWMIServiceremote.ExecQuery _
("Select * from Win32_OperatingSystem")
For Each objComputer in colComputereremote
remotets = objComputer.LocalDateTime
WScript.Echo remotets
Next
WScript.Quit
I have tried the same code with a Windows XP Embedded machine (same config as the Win7 machine) and it works fine.
After digging some related questions, I found a suggestion that worked for me: I had to add the user account whose credentials ("dts" and "dts" in my code) I was using to remotely access WMI to the groups "Distributed COM Users" and "Performance Monitor Users". This needs to be changed in the target remote Windows 7 machine.
The information can be found in this link.
Also, the information on how to add a user to specific groups in Windows 7 standard can be found here.