From: Eric on 13 Jan 2010 13:23 On Jan 12, 4:39 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > "Eric" <edoug...(a)blockhouse.com> said this in news itemnews:63b31a85-0957-429b-ac88-7c6f5c8ad4b5(a)m11g2000vbo.googlegroups.com... > > > > > > > On Jan 12, 10:19 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > >> See inline. > > >> "Eric" <edoug...(a)blockhouse.com> said this in news > >> itemnews:afe5bf19-4d9b-41f5-9b34-7e9fc7bab547(a)k22g2000vbp.googlegroups..com... > > >> > On Jan 8, 4:52 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > >> >> I gave you an EMail function in my reply of two weeks ago. Did you use > >> >> the > >> >> function? If something is not clear then please say exactly what it > >> >> is. > > >> >> Note also that while WMI is a wonderful thing, it can place a heavy > >> >> load > >> >> on > >> >> the CPU. I recommend that you check your CPU loading before finalising > >> >> this > >> >> project. > > >> >> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news > >> >> itemnews:E4204C0F-B9A5-4911-AFCD-0C3BD13AFA8C(a)microsoft.com... > > >> >> > I have this, but as email command?? > > >> >> > Option Explicit > > >> >> > Dim strComputer, objWMIService, colMonitoredDisks, objDiskChange > >> >> > Dim i, strMessage > >> >> > Const LOCAL_HARD_DISK = 3 > > >> >> > strComputer = "West204" > >> >> > Set objWMIService = GetObject("winmgmts:" & > >> >> > "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" & > >> >> > strComputer & "\root\cimv2") > >> >> > Set colMonitoredDisks = objWMIService.ExecNotificationQuery > >> >> > ("SELECT * > >> >> > FROM __instancemodificationevent WITHIN 30 WHERE " & > >> >> > "TargetInstance > >> >> > ISA > >> >> > 'Win32_LogicalDisk'") > >> >> > i = 0 > >> >> > Do While i = 0 > >> >> > Set objDiskChange = colMonitoredDisks.NextEvent > >> >> > If objDiskChange.TargetInstance.DriveType = LOCAL_HARD_DISK Then > >> >> > If objDiskChange.TargetInstance.Size < 100000000 Then > >> >> > strMessage = "Hard disk " & > >> >> > objDiskChange.TargetInstance.Name > >> >> > & " on computer " & strComputer & " is below 100,000,000 bytes." > >> >> > End If > >> >> > End If > >> >> > Loop > > >> >> > "MiguelA" <ma.camal...(a)NOSPAMgmail.com> wrote in message > >> >> >news:eJ$ivHjiKHA.5248(a)TK2MSFTNGP04.phx.gbl... > >> >> >>I will try and tell you something > > >> >> >> "Pegasus [MVP]" <n...(a)microsoft.com> wrote in message > >> >> >>news:e4ixPEjiKHA.5568(a)TK2MSFTNGP02.phx.gbl... > >> >> >>> When you examine and run the script then you will see several > >> >> >>> things: > >> >> >>> a) The script will inspect *all* drive letters. > >> >> >>> b) The property oDrive.Path shows the drive letter (e.g. D:) > >> >> >>> c) The property oDrive.AvailableSpace shows the amount of free > >> >> >>> space. > > >> >> >>> You now need to compare oDrive.AvailableSpace against whatever > >> >> >>> limit > >> >> >>> you > >> >> >>> wish to set, then invoke the EMail module if your free space drops > >> >> >>> below > >> >> >>> the set limit. > > >> >> >>> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news item > >> >> >>>news:#9fXH8iiKHA.5524(a)TK2MSFTNGP06.phx.gbl... > >> >> >>>> I do not understand is as if it detects that there is little > >> >> >>>> space > >> >> >>>> to > >> >> >>>> run the email sending. > >> >> >>>> If a server has multiple disks, it detects all?. > > >> >> >>>> "Pegasus [MVP]" <n...(a)microsoft.com> wrote in message > >> >> >>>>news:OJ4oH5iiKHA.1236(a)TK2MSFTNGP04.phx.gbl... > > >> >> >>>>> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news item > >> >> >>>>>news:86144BCB-29F3-43B4-AF6A-081C68F0E83B(a)microsoft.com... > >> >> >>>>>> I can not implement all the code! > > >> >> >>>>> The idea is for you to grab the parts that are relevant for you. > >> >> >>>>> Feel > >> >> >>>>> free to ask if certain details are unclear.- Hide quoted text - > > >> >> - Show quoted text - > > >> > Am I correct that your script in this thread is designed to run > >> > locally on the server? > > >> *** Yes. > > >> > Is there a way to write a script that can get drive and directory size > >> > information for a server, running on a client pc with network admin > >> > credentials? > > >> *** Yes, WMI is one method, psexec.exe another. > > >> > From what I can find on the FSO, it only works on the local pc or > >> > mapped drives. > > >> *** Correct. > > >> > I have a working script which connects to the servers and gets drive > >> > space info from Win32_DiskDrive. Now I want more details, to show > >> > which folders are using the most space, without having the folders > >> > marked as shared. > >> > This would seem simple if I ran it locally on the server but I want to > >> > be able to run it from my client pc and I want it to connect to get > >> > info from multiple servers. > > >> *** For good performance I would launch psexec.exe from a batch > >> *** file on the server, to address each client PC in turn.- Hide quoted > >> text - > > >> - Show quoted text - > > > So you're saying the only way to get directory size information for > > another PC for all folders, not just shared folders, is to run a local > > FSO script using PsTools (http://technet.microsoft.com/en-us/ > > sysinternals/bb897553.aspx)? > > *** No. I wrote "WMI is one method, psexec.exe another". You should also > look at the OP's script - he uses WMI.- Hide quoted text - > > - Show quoted text - That WMI script is just getting the hard disk space used/available info. I want that broken down by folder, possibly by file. Can WMI get the folder details? I don't really care who it's displayed. I can put my results in a msgbox locally or write them to a text file either locally or on the server, anywhere is fine. I just want a script I can run on my local PC which can access all drives of multiple servers (without having to share them to map for local access) and tell me what is using the most space. I can run this script with network admin credentials if necessary.
From: Pegasus [MVP] on 13 Jan 2010 14:36 "Eric" <edouglas(a)blockhouse.com> said this in news item news:554734a5-f0bc-4370-bea4-a064859a56f9(a)k22g2000vbp.googlegroups.com... > On Jan 12, 4:39 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: >> "Eric" <edoug...(a)blockhouse.com> said this in news >> itemnews:63b31a85-0957-429b-ac88-7c6f5c8ad4b5(a)m11g2000vbo.googlegroups.com... >> >> >> >> >> >> > On Jan 12, 10:19 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: >> >> See inline. >> >> >> "Eric" <edoug...(a)blockhouse.com> said this in news >> >> itemnews:afe5bf19-4d9b-41f5-9b34-7e9fc7bab547(a)k22g2000vbp.googlegroups.com... >> >> >> > On Jan 8, 4:52 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: >> >> >> I gave you an EMail function in my reply of two weeks ago. Did you >> >> >> use >> >> >> the >> >> >> function? If something is not clear then please say exactly what it >> >> >> is. >> >> >> >> Note also that while WMI is a wonderful thing, it can place a heavy >> >> >> load >> >> >> on >> >> >> the CPU. I recommend that you check your CPU loading before >> >> >> finalising >> >> >> this >> >> >> project. >> >> >> >> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news >> >> >> itemnews:E4204C0F-B9A5-4911-AFCD-0C3BD13AFA8C(a)microsoft.com... >> >> >> >> > I have this, but as email command?? >> >> >> >> > Option Explicit >> >> >> >> > Dim strComputer, objWMIService, colMonitoredDisks, objDiskChange >> >> >> > Dim i, strMessage >> >> >> > Const LOCAL_HARD_DISK = 3 >> >> >> >> > strComputer = "West204" >> >> >> > Set objWMIService = GetObject("winmgmts:" & >> >> >> > "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" & >> >> >> > strComputer & "\root\cimv2") >> >> >> > Set colMonitoredDisks = objWMIService.ExecNotificationQuery >> >> >> > ("SELECT * >> >> >> > FROM __instancemodificationevent WITHIN 30 WHERE " & >> >> >> > "TargetInstance >> >> >> > ISA >> >> >> > 'Win32_LogicalDisk'") >> >> >> > i = 0 >> >> >> > Do While i = 0 >> >> >> > Set objDiskChange = colMonitoredDisks.NextEvent >> >> >> > If objDiskChange.TargetInstance.DriveType = LOCAL_HARD_DISK >> >> >> > Then >> >> >> > If objDiskChange.TargetInstance.Size < 100000000 Then >> >> >> > strMessage = "Hard disk " & >> >> >> > objDiskChange.TargetInstance.Name >> >> >> > & " on computer " & strComputer & " is below 100,000,000 bytes." >> >> >> > End If >> >> >> > End If >> >> >> > Loop >> >> >> >> > "MiguelA" <ma.camal...(a)NOSPAMgmail.com> wrote in message >> >> >> >news:eJ$ivHjiKHA.5248(a)TK2MSFTNGP04.phx.gbl... >> >> >> >>I will try and tell you something >> >> >> >> >> "Pegasus [MVP]" <n...(a)microsoft.com> wrote in message >> >> >> >>news:e4ixPEjiKHA.5568(a)TK2MSFTNGP02.phx.gbl... >> >> >> >>> When you examine and run the script then you will see several >> >> >> >>> things: >> >> >> >>> a) The script will inspect *all* drive letters. >> >> >> >>> b) The property oDrive.Path shows the drive letter (e.g. D:) >> >> >> >>> c) The property oDrive.AvailableSpace shows the amount of free >> >> >> >>> space. >> >> >> >> >>> You now need to compare oDrive.AvailableSpace against whatever >> >> >> >>> limit >> >> >> >>> you >> >> >> >>> wish to set, then invoke the EMail module if your free space >> >> >> >>> drops >> >> >> >>> below >> >> >> >>> the set limit. >> >> >> >> >>> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news item >> >> >> >>>news:#9fXH8iiKHA.5524(a)TK2MSFTNGP06.phx.gbl... >> >> >> >>>> I do not understand is as if it detects that there is little >> >> >> >>>> space >> >> >> >>>> to >> >> >> >>>> run the email sending. >> >> >> >>>> If a server has multiple disks, it detects all?. >> >> >> >> >>>> "Pegasus [MVP]" <n...(a)microsoft.com> wrote in message >> >> >> >>>>news:OJ4oH5iiKHA.1236(a)TK2MSFTNGP04.phx.gbl... >> >> >> >> >>>>> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news >> >> >> >>>>> item >> >> >> >>>>>news:86144BCB-29F3-43B4-AF6A-081C68F0E83B(a)microsoft.com... >> >> >> >>>>>> I can not implement all the code! >> >> >> >> >>>>> The idea is for you to grab the parts that are relevant for >> >> >> >>>>> you. >> >> >> >>>>> Feel >> >> >> >>>>> free to ask if certain details are unclear.- Hide quoted >> >> >> >>>>> text - >> >> >> >> - Show quoted text - >> >> >> > Am I correct that your script in this thread is designed to run >> >> > locally on the server? >> >> >> *** Yes. >> >> >> > Is there a way to write a script that can get drive and directory >> >> > size >> >> > information for a server, running on a client pc with network admin >> >> > credentials? >> >> >> *** Yes, WMI is one method, psexec.exe another. >> >> >> > From what I can find on the FSO, it only works on the local pc or >> >> > mapped drives. >> >> >> *** Correct. >> >> >> > I have a working script which connects to the servers and gets drive >> >> > space info from Win32_DiskDrive. Now I want more details, to show >> >> > which folders are using the most space, without having the folders >> >> > marked as shared. >> >> > This would seem simple if I ran it locally on the server but I want >> >> > to >> >> > be able to run it from my client pc and I want it to connect to get >> >> > info from multiple servers. >> >> >> *** For good performance I would launch psexec.exe from a batch >> >> *** file on the server, to address each client PC in turn.- Hide >> >> quoted >> >> text - >> >> >> - Show quoted text - >> >> > So you're saying the only way to get directory size information for >> > another PC for all folders, not just shared folders, is to run a local >> > FSO script using PsTools (http://technet.microsoft.com/en-us/ >> > sysinternals/bb897553.aspx)? >> >> *** No. I wrote "WMI is one method, psexec.exe another". You should also >> look at the OP's script - he uses WMI.- Hide quoted text - >> >> - Show quoted text - > > That WMI script is just getting the hard disk space used/available > info. I want that broken down by folder, possibly by file. Can WMI > get the folder details? > > I don't really care who it's displayed. I can put my results in a > msgbox locally or write them to a text file either locally or on the > server, anywhere is fine. I just want a script I can run on my local > PC which can access all drives of multiple servers (without having to > share them to map for local access) and tell me what is using the most > space. I can run this script with network admin credentials if > necessary. Based on the link below, you could do something like this: sDrive = "D:\" Set oFSO = CreateObject("Scripting.FileSystemObject") Set oRoot = oFSO.GetFolder(sDrive) For Each oFolder In oRoot.SubFolders On Error Resume Next iSize = oFSO.GetFolder(oFolder.Path).Size If Err.number = 0 Then WScript.Echo Right(Space(14) & iSize, 14), oFolder.Path Else WScript.Echo "(Inaccessible)", oFolder.Path End If On Error Goto 0 Next http://blogs.technet.com/heyscriptingguy/archive/2004/11/18/can-i-use-a-script-to-determine-the-size-of-a-folder-on-a-remote-computer.aspx
From: Eric on 13 Jan 2010 14:58 On Jan 13, 2:36 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > "Eric" <edoug...(a)blockhouse.com> said this in news itemnews:554734a5-f0bc-4370-bea4-a064859a56f9(a)k22g2000vbp.googlegroups.com... > > > > > > > On Jan 12, 4:39 pm, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > >> "Eric" <edoug...(a)blockhouse.com> said this in news > >> itemnews:63b31a85-0957-429b-ac88-7c6f5c8ad4b5(a)m11g2000vbo.googlegroups..com... > > >> > On Jan 12, 10:19 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > >> >> See inline. > > >> >> "Eric" <edoug...(a)blockhouse.com> said this in news > >> >> itemnews:afe5bf19-4d9b-41f5-9b34-7e9fc7bab547(a)k22g2000vbp.googlegroups.com... > > >> >> > On Jan 8, 4:52 am, "Pegasus [MVP]" <n...(a)microsoft.com> wrote: > >> >> >> I gave you an EMail function in my reply of two weeks ago. Did you > >> >> >> use > >> >> >> the > >> >> >> function? If something is not clear then please say exactly what it > >> >> >> is. > > >> >> >> Note also that while WMI is a wonderful thing, it can place a heavy > >> >> >> load > >> >> >> on > >> >> >> the CPU. I recommend that you check your CPU loading before > >> >> >> finalising > >> >> >> this > >> >> >> project. > > >> >> >> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news > >> >> >> itemnews:E4204C0F-B9A5-4911-AFCD-0C3BD13AFA8C(a)microsoft.com... > > >> >> >> > I have this, but as email command?? > > >> >> >> > Option Explicit > > >> >> >> > Dim strComputer, objWMIService, colMonitoredDisks, objDiskChange > >> >> >> > Dim i, strMessage > >> >> >> > Const LOCAL_HARD_DISK = 3 > > >> >> >> > strComputer = "West204" > >> >> >> > Set objWMIService = GetObject("winmgmts:" & > >> >> >> > "{impersonationLevel=impersonate,authenticationLevel=Pkt}!\\" & > >> >> >> > strComputer & "\root\cimv2") > >> >> >> > Set colMonitoredDisks = objWMIService.ExecNotificationQuery > >> >> >> > ("SELECT * > >> >> >> > FROM __instancemodificationevent WITHIN 30 WHERE " & > >> >> >> > "TargetInstance > >> >> >> > ISA > >> >> >> > 'Win32_LogicalDisk'") > >> >> >> > i = 0 > >> >> >> > Do While i = 0 > >> >> >> > Set objDiskChange = colMonitoredDisks.NextEvent > >> >> >> > If objDiskChange.TargetInstance.DriveType = LOCAL_HARD_DISK > >> >> >> > Then > >> >> >> > If objDiskChange.TargetInstance.Size < 100000000 Then > >> >> >> > strMessage = "Hard disk " & > >> >> >> > objDiskChange.TargetInstance.Name > >> >> >> > & " on computer " & strComputer & " is below 100,000,000 bytes.." > >> >> >> > End If > >> >> >> > End If > >> >> >> > Loop > > >> >> >> > "MiguelA" <ma.camal...(a)NOSPAMgmail.com> wrote in message > >> >> >> >news:eJ$ivHjiKHA.5248(a)TK2MSFTNGP04.phx.gbl... > >> >> >> >>I will try and tell you something > > >> >> >> >> "Pegasus [MVP]" <n...(a)microsoft.com> wrote in message > >> >> >> >>news:e4ixPEjiKHA.5568(a)TK2MSFTNGP02.phx.gbl... > >> >> >> >>> When you examine and run the script then you will see several > >> >> >> >>> things: > >> >> >> >>> a) The script will inspect *all* drive letters. > >> >> >> >>> b) The property oDrive.Path shows the drive letter (e.g. D:) > >> >> >> >>> c) The property oDrive.AvailableSpace shows the amount of free > >> >> >> >>> space. > > >> >> >> >>> You now need to compare oDrive.AvailableSpace against whatever > >> >> >> >>> limit > >> >> >> >>> you > >> >> >> >>> wish to set, then invoke the EMail module if your free space > >> >> >> >>> drops > >> >> >> >>> below > >> >> >> >>> the set limit. > > >> >> >> >>> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news item > >> >> >> >>>news:#9fXH8iiKHA.5524(a)TK2MSFTNGP06.phx.gbl... > >> >> >> >>>> I do not understand is as if it detects that there is little > >> >> >> >>>> space > >> >> >> >>>> to > >> >> >> >>>> run the email sending. > >> >> >> >>>> If a server has multiple disks, it detects all?. > > >> >> >> >>>> "Pegasus [MVP]" <n...(a)microsoft.com> wrote in message > >> >> >> >>>>news:OJ4oH5iiKHA.1236(a)TK2MSFTNGP04.phx.gbl... > > >> >> >> >>>>> "MiguelA" <ma.camal...(a)NOSPAMgmail.com> said this in news > >> >> >> >>>>> item > >> >> >> >>>>>news:86144BCB-29F3-43B4-AF6A-081C68F0E83B(a)microsoft.com... > >> >> >> >>>>>> I can not implement all the code! > > >> >> >> >>>>> The idea is for you to grab the parts that are relevant for > >> >> >> >>>>> you. > >> >> >> >>>>> Feel > >> >> >> >>>>> free to ask if certain details are unclear.- Hide quoted > >> >> >> >>>>> text - > > >> >> >> - Show quoted text - > > >> >> > Am I correct that your script in this thread is designed to run > >> >> > locally on the server? > > >> >> *** Yes. > > >> >> > Is there a way to write a script that can get drive and directory > >> >> > size > >> >> > information for a server, running on a client pc with network admin > >> >> > credentials? > > >> >> *** Yes, WMI is one method, psexec.exe another. > > >> >> > From what I can find on the FSO, it only works on the local pc or > >> >> > mapped drives. > > >> >> *** Correct. > > >> >> > I have a working script which connects to the servers and gets drive > >> >> > space info from Win32_DiskDrive. Now I want more details, to show > >> >> > which folders are using the most space, without having the folders > >> >> > marked as shared. > >> >> > This would seem simple if I ran it locally on the server but I want > >> >> > to > >> >> > be able to run it from my client pc and I want it to connect to get > >> >> > info from multiple servers. > > >> >> *** For good performance I would launch psexec.exe from a batch > >> >> *** file on the server, to address each client PC in turn.- Hide > >> >> quoted > >> >> text - > > >> >> - Show quoted text - > > >> > So you're saying the only way to get directory size information for > >> > another PC for all folders, not just shared folders, is to run a local > >> > FSO script using PsTools (http://technet.microsoft.com/en-us/ > >> > sysinternals/bb897553.aspx)? > > >> *** No. I wrote "WMI is one method, psexec.exe another". You should also > >> look at the OP's script - he uses WMI.- Hide quoted text - > > >> - Show quoted text - > > > That WMI script is just getting the hard disk space used/available > > info. I want that broken down by folder, possibly by file. Can WMI > > get the folder details? > > > I don't really care who it's displayed. I can put my results in a > > msgbox locally or write them to a text file either locally or on the > > server, anywhere is fine. I just want a script I can run on my local > > PC which can access all drives of multiple servers (without having to > > share them to map for local access) and tell me what is using the most > > space. I can run this script with network admin credentials if > > necessary. > > Based on the link below, you could do something like this: > > sDrive = "D:\" > Set oFSO = CreateObject("Scripting.FileSystemObject") > Set oRoot = oFSO.GetFolder(sDrive) > > For Each oFolder In oRoot.SubFolders > On Error Resume Next > iSize = oFSO.GetFolder(oFolder.Path).Size > If Err.number = 0 Then > WScript.Echo Right(Space(14) & iSize, 14), oFolder.Path > Else > WScript.Echo "(Inaccessible)", oFolder.Path > End If > On Error Goto 0 > Next > > http://blogs.technet.com/heyscriptingguy/archive/2004/11/18/can-i-use...- Hide quoted text - > > - Show quoted text - Thanks! Your script sample here looks like it only works for the local PC, but at least one of the ideas in that link should work for a remote (server) PC. Hopefully the simpler ideas work, otherwise I'll have to write the last resort option, to write a separate script that gets folder info for the local machine, then copy that script to a shared folder on the server and run a command to remote execute it locally to get the non-shared folder info, then remove the script from the server.
First
|
Prev
|
Pages: 1 2 3 4 Prev: Trying to run a non-Win32 Application Next: Rename files based on file name? |