2 Replies Latest reply on Mar 20, 2014 3:59 PM by mwilke

    sbadmcl cleanupmachinegroup script needed

    mwilke

      I need a vb script or a bat file that i can loop through a text file containing all my machine groups.

       

      I am trying to run the cleanupmachinegroups command via sbadmcl but the problem is i have about 200 machine groups.  I have all my machine groups listed in a text file i just need a simple bat file or vbs file to loop through that text file so i dont have to set here and run this command 200 times. 

       

      Anyone out there with such a script or bat?

        • 1. Re: sbadmcl cleanupmachinegroup script needed

          like

           

          for /F %1 in (filename.text) do echo %1

           

          on a command line will process each line of text in a file (and echo it)

           

          to do it in VBScript is a little harder, but gives you more flexibility.

           

          dim oFSO : set oFSO = createobject("scripting.filesystemobject")

          dim oFile : set oFile = oFSO.OpenTextFile("test.txt",1)

          while not oFile.AtEndOfStream

                     WScript.Echo oFile.ReadLine

          Wend

           

          will read the file line by line,

           

           

          set oFSO = createobject("scripting.filesystemobject")

          data = oFSO.OpenTextFile("test.txt",1).readall

          data = Split(data,vbCrLf)

          For Each item In data

                    WScript.Echo item

          next

           

          will read the whole file, split it by line feeds and output it (probaby faster as there are less reads)

           

          Finally, can't you use "*" as a group name? I know that works with some commands - not sure about the cleanup ones though.

           

          Message was edited by: SafeBoot on 3/20/14 4:52:28 PM EDT
          • 2. Re: sbadmcl cleanupmachinegroup script needed
            mwilke

            Unfortunatley the * wild card doesnt work with this one.  Thanks for the info though.  Ill give them a shot.