I am trying to find a way to run NONAV no a remote machine, so far i have managed to put this script together but it seems to run NoNAV on the machine you run the script on no the remote machine listed in a text file.
Const ForReading = 1
set mFso = CreateObject("Scripting.fileSystemObject")
set wshShell = CreateObject("Wscript.Shell")
strComputer = "Computer_List.txt"
Set tsfile = mFso.openTextFile (strComputer, ForReading)
'call Routine to Remove Nav
NoNav
tsfile.close
MsgBox "Nav Removed from all Machines"
'==========================================================
Sub NoNav
'==========================================================
On Error Resume Next
Do
strComputers = tsfile.ReadLine
Computer = strComputers
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2")
Set objShell = CreateObject("WScript.Shell")
rem objShell.Run("%comspec% /c md \\" & Computer & "\NoNAV")
rem objShell.Run("%comspec% /c copy \\10.140.68.10\NoNav\*.* \\" & computer & "\NoNav")
objShell.Run(" \\" & Computer & "\NoNAV\NoNav.bat "),0,True
Loop While tsfile.AtEndoFStream = False
End Sub
Const ForReading = 1
set mFso = CreateObject("Scripting.fileSystemObject")
set wshShell = CreateObject("Wscript.Shell")
strComputer = "Computer_List.txt"
Set tsfile = mFso.openTextFile (strComputer, ForReading)
'call Routine to Remove Nav
NoNav
tsfile.close
MsgBox "Nav Removed from all Machines"
'==========================================================
Sub NoNav
'==========================================================
On Error Resume Next
Do
strComputers = tsfile.ReadLine
Computer = strComputers
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & Computer & "\root\cimv2")
Set objShell = CreateObject("WScript.Shell")
rem objShell.Run("%comspec% /c md \\" & Computer & "\NoNAV")
rem objShell.Run("%comspec% /c copy \\10.140.68.10\NoNav\*.* \\" & computer & "\NoNav")
objShell.Run(" \\" & Computer & "\NoNAV\NoNav.bat "),0,True
Loop While tsfile.AtEndoFStream = False
End Sub