notalot Posted February 8, 2010 Posted February 8, 2010 Ok properly me being daft but I’ve been trying to write a script that call a process if there are less than 10 copies running, but for some reason I cant count the number of process running, colProcessList.Count only comes back with 1. On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set objShell = CreateObject("WScript.Shell") Set colProcessList = objWMIService.ExecQuery _ ("Select * from Win32_Process" & _ " Where Name = 'cmd.exe'") dim fs,objTextFileset set fs=CreateObject("Scripting.FileSystemObject") dim arrStr set objTextFile = fs.OpenTextFile("C:\Users\men\Desktop\temp.csv") Set WSHShell = CreateObject("Wscript.Shell") Do while NOT objTextFile.AtEndOfStream arrStr = split(objTextFile.ReadLine,",") If colProcessList.Count = 2 Then wscript.Sleep 4000 Else WSHShell.Run "C:\Users\men\Desktop\xcacls.bat" & " " & arrStr(0) End If loop objTextFile.Closeset objTextFile = Nothingset fs = Nothing Any thoughts or even a better way of getting all the permitions off a Shaired drive.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now