vbscript to delete multiple specific local user accounts from servers
04/14/2016 1487 views
i am trying to write a vbscript to delete specific user account from server.
If in server found the users adm,ame the script should delete and also it should print the result whether the deletion is successful or not. Below is the script which I tried writing and I am getting an error . Can anyone help me to correct this ?
Dim disuser, objNetwork, strComputer, objComputer
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
Set objComputer = GetObject("WinNT://" & strComputer)
On Error Resume Next
For each disuser In "adm ame"
Call objComputer.Delete("user", disuser)
On Error GoTo 0
'On Error res="fail"