Can we calculate "C drive" space for the remote computer Without mapping as network drive.

rsingh40

Member
Hi All,
Can we calculate "C drive" space for the remote computer Without mapping on network drive.

Any other alternative to do so. I have 40 server and need to check it's disk space on regular intervals.

Thanks in advance
 

VJR

Well-Known Member
Hi rsingh40,

- Have you got a chance to try the code in this link.
Instead of C:\ try giving in format \\server\c$.
Since I do not have a network drive I cannot verify the results. I suggest you to try this first on a test machine where invalid results won't affect anything.
Probably it may require administrative access but I am not sure.

- Another option would be for you to make use of code stage by calling the GetDiskFreeSpaceEx Dll.

- A quickest option would be by using the Windows in-built Powershell aplication
Open do prompt and type powershell and hit enter.
Enter the below command after giving the correct servername parameter and see if you are getting the desired results. The size can be later converted to GB by dividing by (1024*1024*1024). But you can see if you are at least getting to see the results.

Get-WmiObject Win32_LogicalDisk -ComputerName $ServerName -Filter "DeviceID='C:'" | Select-Object Size,FreeSpace

If you are able to get the results then as stated in this link you can maintain the list of all those 40 servers in a text file and have Powershell get the disk space details of all those servers.
The output can then also be generated to a text file, which you can even try using the below command.

Get-WmiObject Win32_LogicalDisk -ComputerName $ServerName -Filter "DeviceID='C:'" | Select-Object Size,FreeSpace >C:\DiskInfo.txt

Not sure if you would want to run this manually OR through Blue Prism since you mentioned that you need to monitor the disk space of those servers at regular intervals.
If running through Blue Prism then save the script in a ps1 file and then call it from a .bat file in order to be called from Blue Prism- Refer link.
 
Top