Question

  • Creator
    Topic
  • #2223137

    Remote Batch files

    Locked

    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.

All Answers

  • Author
    Replies
    • #2638809

      Clarifications

      by bentley ·

      In reply to Remote Batch files

      Clarifications

    • #2638755

      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.

    • #2638742

      vbscript

      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}
      result.movenext
      Next

Viewing 2 reply threads