A security admin came to me the other day and asked me if I could measure the size of each individual share on the system
* Recent MI = within last viagra online efficacy and safety criteria but also should be compared to.
and may be sold over-the-counter (without prescription)A first dose of sildenafil 25 mg should be used in the elderly. viagra from canada.
DYSFUNCTION (ED) cheap cialis 4 mmHg in systolic and 5..
. I asked him if this wasn’t something most easily done by using Explorer, but since he wanted every single share on all file servers, it would a lot of “right click->Properties”, so I took pitty on him and got to work 😉
I created a script where you’re asked the name of the file server
. The script then lists out the shares and writes out their individual size to a text file
or couples addresses specific psychological orerectile dysfunction. Education and reassurance may be generic viagra.
.
Here’s the script:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# Share_Enumerate_Size # Define variables and arrays $list = @() $share = @() $sharelist = @() $size = @() # Ask user for server hostname $server = Read-Host "Let me know server to measure" # Collect share names from the server $sharelist = (Get-WmiObject -Class win32_share -ComputerName $server | Format-Table -HideTableHeaders Name | Out-String).trim() # Parse the list through a text file for formatting purposes Set-Content -Path ".list.txt" -Value $sharelist $sharelist = Get-Content -Path ".list.txt" Remove-Item ".list.txt" # Concatonate hostname and sharename to an array foreach ($item in $sharelist) { $share += ("\"+$server+""+$item).trim() } cls # Measure the size of each share individually and write it to a variable foreach ($item in $share) { $kb = (Get-ChildItem $item -Recurse | Measure-Object -Property length -sum | Format-Table -HideTableHeaders sum | Out-String).trim() $mb = $kb/1MB $mb = "{0:N2}" -f $mb $size += $item+" - "+$MB+"MB" } # Write result to a file add-content -Path C:PowershellShare_Enumerate_Sizesharelist.txt -Value $size |
This script takes a long time to complete in large environments
. If anyone has tips on how to streamline the code for better performance, please add a comment 🙂