SysAdmin3000
Technical User
I am new to the scripting world and I need a script that will delete a file on each workstation. I have been trying to figure it out but...err..ahhh...I am lost as heck....
strComputer = "."
Win32_Directory.Name='%systemroot%\system32\drivers\etc'
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
objFile = hosts
For Each objFile
objFile.Delete
I know I need to replace the "." with the string of workstations.
I tried to set the path to %systemroot% as some machines have there root windir in different locations.
The file I need to delete is the hosts file in that directory.
I am trying to figure this out by reading over the MS scripting site and thought I should stop by here as well.
thanks in advance,
sysadmin3000
strComputer = "."
Win32_Directory.Name='%systemroot%\system32\drivers\etc'
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
objFile = hosts
For Each objFile
objFile.Delete
I know I need to replace the "." with the string of workstations.
I tried to set the path to %systemroot% as some machines have there root windir in different locations.
The file I need to delete is the hosts file in that directory.
I am trying to figure this out by reading over the MS scripting site and thought I should stop by here as well.
thanks in advance,
sysadmin3000