Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 27th, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 14  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. How Can I disable user account of admin group on a remote machine with the help of VBS
  2. strUser = "myUser"
  3. strComputer = "myremoteComuter"
  4. strPassword = "myPassword_"
  5.  
  6. Set objUser = GetObject("WinNT://" & strComputer & "/" & strUser & ",user",strUser,strPassword)
  7.  
  8.  
  9. If Err.Number = 0 Then
  10. objUser.AccountDisabled = true
  11. objUser.SetInfo
  12. End If
  13.        
  14. Const ADS_SECURE_AUTHENTICATION = 1
  15. Set objUser = GetObject("WinNT:").OpenDSObject("WinNT://MyDomain/UserNameToEnable,user",AdminUserName,AdminUserPassword, ADS_SECURE_AUTHENTICATION)
  16. objUser.AccountDisabled = true
  17. objUser.SetInfo