Hey Scriping Guys!
I've been using a PowerShell script for a couple of years now to generate a monthly report showing the size of user folders on a number of departmental file servers. It's working just fine on all file servers except one where the users have gotten carried away with creating sub-folders and using realy long descriptive file names. The problem piece of script is this:
$colItems = (Get-ChildItem \\192.168.10.5\marketing -recurse | Measure-Object -property length -sum)
"marketing-serv\marketing: "+"{0:N2}" -f ($colItems.sum / 1GB) + " GB"
The reply I get is:
Get-ChildItem : The specified path, file name, or both are too long. The fully
qualified file name must be less than 260 characters, and the directory name mu
st be less than 248 characters.
At G:\data\Server_space_Report\serverspace2.ps1:37 char:27
+ $colItems = (Get-ChildItem <<<< \\192.168.10.5\marketing -recurse | Measure-Obje
ct -property length -sum)
Yes, the message is correct, however, when I connect to the server, right click the folder and chose properties it returns a size of 128 GB. My questions are
1. Why does clicking on folder properties not produce an error (what is it doing differently from my script)?
2. How can I fix my script?
Thanks,
I've been using a PowerShell script for a couple of years now to generate a monthly report showing the size of user folders on a number of departmental file servers. It's working just fine on all file servers except one where the users have gotten carried away with creating sub-folders and using realy long descriptive file names. The problem piece of script is this:
$colItems = (Get-ChildItem \\192.168.10.5\marketing -recurse | Measure-Object -property length -sum)
"marketing-serv\marketing: "+"{0:N2}" -f ($colItems.sum / 1GB) + " GB"
The reply I get is:
Get-ChildItem : The specified path, file name, or both are too long. The fully
qualified file name must be less than 260 characters, and the directory name mu
st be less than 248 characters.
At G:\data\Server_space_Report\serverspace2.ps1:37 char:27
+ $colItems = (Get-ChildItem <<<< \\192.168.10.5\marketing -recurse | Measure-Obje
ct -property length -sum)
Yes, the message is correct, however, when I connect to the server, right click the folder and chose properties it returns a size of 128 GB. My questions are
1. Why does clicking on folder properties not produce an error (what is it doing differently from my script)?
2. How can I fix my script?
Thanks,