So i have been working on a script to pull network share that are not hidden and display their size. but i am getting a error that states does not contain a method named 'op_addition'. The script should scan for all non hidden file shares and disply their size for what ever it find on the machine it is run on. Any help is greatly appreciated. Thanks.
$startfolder = Get-WmiObject Win32_Share -Filter "not name like '%$'" | Select path
foreach($folder in $startfolder.ToString){
$colItems = (Get-ChildItem $folder -Recurse | Measure-Object -property length -sum)
IF($colItems.Sum -ge 1073741824)
{
$folder + " --" + " {0:n2}" -f ($colItems.sum / 1GB) + " GigaBytes"
}
ELSEIF($colItems.sum -ge 1024)
{
$folder + " --" + " {0:n2}" -f ($colItems.sum / 1MB) + " MegaBytes"
}
ELSE
{ $folder + " --" + " {0:n2}" -f ($colItems.sum / 1KB) + " KiloBytes"
}
}
- Edited by marcb1387 Friday, August 21, 2015 4:27 PM Code structure