Remote Batch files

By bentley ·
I am trying to run a batch file on all my computer in my Active directory at the same time. I know i can run it a startup or login. But i need to make a change in the middle of the night without any user interaction. Please help.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Startup Script

by IC-IT In reply to Remote Batch files

Will run with system credentials. Is there a specific reason that the batch file needs user interaction?
Otherwise just use a WOL and let it run.

Collapse -


by scott_heath In reply to Remote Batch files

I'm sure someone will say this is too complicated, but I like to use vbscript for stuff like this. You can use something like this:

Set oRoot = GetObject("LDAP: //RootDSE")
strRoot = oRoot.Get("defaultNamingContext")
path = "LDAP://" & strRoot
Set oConnect = CreateObject("ADODB.Connection")
Set oCommand = CreateObject("ADODB.Command")
oConnect.Provider = "ADsDSOObject"
oConnect.Open "Active Directory Provider"
Set oCommand.ActiveConnection = oConnect
oCommand.CommandText = "SELECT name FROM '" & path & "' WHERE objectClass='Computer'"
Set result = oCommand.Execute
For i = 1 to result.recordcount
computername = result(0).value
{code to do stuff}

Related Discussions

Related Forums