I'm creating a script that creates a folder and copy's data to a share on the server
First i check wich disk has the most free space
then i create the folder and share on that drive with most free space
No i have the following problem , i have 8 drives C, D, E, F, G, H, I, J
The script checks only for disk with most free space
Now the folder got created on C an D And J wich are the drives with the most free space
but aren't allowed to be used.
How to i exclude the drives from checking for free space ?
the script for free space checking is:
How do i acomplish this ?
thx for reading my question
First i check wich disk has the most free space
then i create the folder and share on that drive with most free space
No i have the following problem , i have 8 drives C, D, E, F, G, H, I, J
The script checks only for disk with most free space
Now the folder got created on C an D And J wich are the drives with the most free space
but aren't allowed to be used.
How to i exclude the drives from checking for free space ?
the script for free space checking is:
Code:
strserver = "dafwesmfs1"
mostFree = 0
set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strserver & "\root\cimv2")
' Drive Type 3 is for Hard Disk
Set objDisks = objWMIService.ExecQuery _
("Select * from Win32_LogicalDisk Where DriveType = 3")
' Enumerate Each Drive
For Each objDisk in objDisks
numFreeSpace = objDisk.FreeSpace
If mostFree > 0 Then
If mostFree - objDisk.FreeSpace < 1 Then
mostFree = objDisk.FreeSpace
mostFreeDrive = objDisk.DeviceID
End If
ElseIf objDisk.FreeSpace > 0 Then
mostFree = objDisk.FreeSpace
mostFreeDrive = objDisk.DeviceID
End If
next
letter=Mid(mostFreeDrive, 1, 1)
wscript.echo "drive letter is: " & letter
How do i acomplish this ?
thx for reading my question