Help script listing disks

0

Good morning everyone. My goal is to list the disks of the different teams of the same network monthly to check the used size of these, and in case it is almost full I sent a warning (In the same folder where the disks are listed, although with " WARNING "written on it.

I've seen that it could be with powershell but I'm not familiar with it.

It is not necessary to be done with powershell, it can be executed by tasks programmed from each computer (although if there is some way to do it from oneself better). If you find any other way to do it, I'd appreciate it.

PS: All are windows that can be from xp to 8

Thank you very much =)

    
asked by Lagrimar 04.05.2017 в 14:42
source

1 answer

1

Ok, I solved it with powershell using the following command:

Get-WmiObject win32_logicaldisk |Where-Object { $_.DriveType -ge 3 }| Select DeviceID,VolumeName,@{Name="Size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}},@{Name="FreeSpace(GB)";Expression={"{0:N1}" -f($_.freespace/1gb)}}

For those who had my problem $_.DriveType -ge 3 indicates the local and network units. According to the number that you put you will get 2 = external 3 = local 4 = network, so I put ge (greater or equal). The rest indicates the letter that you have placed on the disk where you run the script, the name of the unit (on the destination computer), full size and free disk space.

    
answered by 19.05.2017 / 12:49
source