KAKA JI
asked on
Size of users home drive
Powershell Script to get Home Drive (Homedir) size for list of users in CSV file with only Samaccountname
ASKER
Does not seems to work for ma mate
[PS] C:\ProgramData\Microsoft\W indows\Sta rt Menu\Programs\Microsoft Exchange Server 2010>$Mailboxes = Get-Mailbox -ResultSize 20 foreach ($Mailbox in $Mailboxes) { $Mailbox | Add-Member -MemberType "NoteProperty" -Name "MailboxSizeMB" -Value ((Get-MailboxStatistics $Mailbox).TotalItemSize.Va lue.ToMb() ) } $Mailboxes | Sort-Object MailboxSizeMB -Desc | Select DisplayName, Alias, PrimarySMTPAddress, MailboxSizeMB
in : Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (in:String) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : UnexpectedToken
[PS] C:\ProgramData\Microsoft\W
in : Unexpected token 'in' in expression or statement.
+ CategoryInfo : ParserError: (in:String) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : UnexpectedToken
Try this:
foreach ($user in (Import-Csv .\ADUsers.csv)) {
$folder = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirectory).HomeDirectory)
$size = $folder.BaseName.Length
[array]$results += New-Object -TypeName PSObject -Property @{
sAMAccountName = $($user.samaccountname)
HomeDirectory = $folder
Size = $size
}
}
$results | Export-Csv "$env:USERPROFILE\Desktop\HomeDirSizes.csv" -NoTypeInformation
ASKER
Hi Jason,
I am getting the following error.
[PS] C:\ProgramData\Microsoft\W indows\Sta rt Menu\Programs\Microsoft Exchange Server 2010>foreach ($user in (Import-Csv C:\Spam\User.csv)) { $folder = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirectory).HomeDirecto ry) $size = $folder.BaseName.Length[ar ray]$resul ts += New-Object -TypeName PSObject -Property @{sAMAccountName = $($user.samaccountname)Hom eDirectory = $folder Size = $size}}$results | Export-Csv "C:\Spam\HomeDirSizes.csv" -NoTypeInformation
[ : Missing or invalid array index expression.
+ CategoryInfo : ParserError: ([:String) [], ParentContainsErrorRecordE xception
+ FullyQualifiedErrorId : MissingArrayIndexExpressio n
I am getting the following error.
[PS] C:\ProgramData\Microsoft\W
[ : Missing or invalid array index expression.
+ CategoryInfo : ParserError: ([:String) [], ParentContainsErrorRecordE
+ FullyQualifiedErrorId : MissingArrayIndexExpressio
ASKER
Hi Jason,
Please see below
PS C:\Windows> foreach ($user in (Import-Csv C:\Spam\User.csv)) {
$folder = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirectory).HomeDirecto ry)
$size = $folder.BaseName.Length
[array]$results += New-Object -TypeName PSObject -Property @{
sAMAccountName = $($user.samaccountname)
HomeDirectory = $folder
Size = $size
}
}
$results | Export-Csv "C:\Spam\HomeDirSizes.csv" -NoTypeInformation
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Please see below
PS C:\Windows> foreach ($user in (Import-Csv C:\Spam\User.csv)) {
$folder = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirectory).HomeDirecto
$size = $folder.BaseName.Length
[array]$results += New-Object -TypeName PSObject -Property @{
sAMAccountName = $($user.samaccountname)
HomeDirectory = $folder
Size = $size
}
}
$results | Export-Csv "C:\Spam\HomeDirSizes.csv"
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((Get-ADUser $user.samaccountname -Properties HomeDirecto ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Are you running this script on your Domain Controller or on your workstation? We can make either work but it would take a few tweaks.
ASKER
On my PC
The first script I provided should work on a Domain Controller after the ActiveDirectory module is imported into PowerShell. However, if you did want to limit the script to your workstation, try this:
foreach ($user in (Import-Csv .\ADUsers.csv)) {
$folder = Get-Item ((([adsisearcher]"samaccountname=$($user.samaccountname)").FindOne()).Properties.homedirectory)
$size = $folder.BaseName.Length
[array]$results += New-Object -TypeName PSObject -Property @{
sAMAccountName = $($user.samaccountname)
HomeDirectory = $folder
Size = $size
}
}
$results | Export-Csv "$env:USERPROFILE\Desktop\HomeDirSizes.csv" -NoTypeInformation
ASKER
Hi,
Still not working
PS C:\Windows> foreach ($user in (Import-Csv C:\spam\User.csv)) {
$folder = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) ").FindOne ()).Proper ties.homed irectory)
$size = $folder.BaseName.Length
[array]$results += New-Object -TypeName PSObject -Property @{
sAMAccountName = $($user.samaccountname)
HomeDirectory = $folder
Size = $size
}
}
$results | Export-Csv "$env:USERPROFILE\Desktop\ HomeDirSiz es.csv" -NoTypeInformation
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou ntname=$($ user.samac countname) " ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation Exception
+ FullyQualifiedErrorId : ParameterArgumentValidatio nErrorNull NotAllowed ,Microsoft .PowerShel l.Commands .GetItemCo mmand
PS C:\Windows>
Still not working
PS C:\Windows> foreach ($user in (Import-Csv C:\spam\User.csv)) {
$folder = Get-Item ((([adsisearcher]"samaccou
$size = $folder.BaseName.Length
[array]$results += New-Object -TypeName PSObject -Property @{
sAMAccountName = $($user.samaccountname)
HomeDirectory = $folder
Size = $size
}
}
$results | Export-Csv "$env:USERPROFILE\Desktop\
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
Get-Item : Cannot bind argument to parameter 'Path' because it is null.
At line:2 char:24
+ ... = Get-Item ((([adsisearcher]"samaccou
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [Get-Item], ParameterBindingValidation
+ FullyQualifiedErrorId : ParameterArgumentValidatio
PS C:\Windows>
Does it have to be powershell?
Unix has du, and Systernals created du for Windows. It's really much easier to use.
https://docs.microsoft.com/en-us/sysinternals/downloads/du
Unix has du, and Systernals created du for Windows. It's really much easier to use.
https://docs.microsoft.com/en-us/sysinternals/downloads/du
Does the account you're logged in with have permission to view the contents of each user's home directory? This works fine on my workstation.
ASKER
Yes I am using my adm account
ASKER
Hi Serialband,
I have try that link but the application does not seem to work. I have also used tree size to get the same info.
https://www.jam-software.com/treesize_free/
I have try that link but the application does not seem to work. I have also used tree size to get the same info.
https://www.jam-software.com/treesize_free/
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
https://community.spiceworks.com/scripts/show/1942-get-the-size-of-your-user-s-ad-home-directory
https://community.spiceworks.com/scripts/show_download/1942-get-the-size-of-your-user-s-ad-home-directory