0

I am trying to run the following command in cmd with admin mode:

psexec -u mydomain\myuser -p mypass net time /set /domain:%USERDOMAIN% /y

I am getting: 'net exited with error code 2'

this is only working when i change UAC level to 3 (instead of 4)

how can resolve this problem? how can i sync the clock of the server? maybe there is a powershell alternative?

I need your help

Thanks!

user829174
  • 6,132
  • 24
  • 75
  • 125

1 Answers1

0

You will need to elevate your account with any script language you prefer. All processes are run with user rights on Win 7/Vista/Win 2008 hosts until you elevate them to admin. Elevating rights will require a script.

You can use the following WMI short sample code with the proper "impersonationLevel=Impersonate" syntax, where "Impersonate" is replaced with "admin" if you sign your code (which can be a pain):

' Enumerate cimv2 on remote host strComputer
Set objWMIService = GetObject("winmgmts:" & _
"{impersonationLevel=Impersonate}!//" & strComputer & "\root\cimv2")
Lizz
  • 1,442
  • 5
  • 25
  • 51