I'm having a bit of trouble with using Set-QADUser and don't understand what I'm doing wrong.
If I run
Get-QADUser -SiteLimit 13000 | where {$_.Company} | % {Write-Host $_.name $_.company}
I get the group of AD records I want to blank out the Company field. When I try to do the set-qaduser I get an error:
Set-QADUser : Value does not fall within the expected range. At line 1 char 68
Char 68 is the space between Set_QADUser & $_
Code I'm using:
$cred = Get-Credential
Get-QADUser -SiteLimit 13000 | where {$_.Company} | % {Set-QADUser $_ -Company '' -Credential $cred}
set-qaduser error
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
set-qaduser error
I'm having a bit of trouble with using Set-QADUser and don't understand what I'm doing wrong.
If I run
Get-QADUser -SiteLimit 13000 | where {$_.Company} | % {Write-Host $_.name $_.company}
I get the group of AD records I want to blank out the Company field. When I try to do the set-qaduser I get an error:
Set-QADUser : Value does not fall within the expected range. At line 1 char 68
Char 68 is the space between Set_QADUser & $_
Code I'm using:
$cred = Get-Credential
Get-QADUser -SiteLimit 13000 | where {$_.Company} | % {Set-QADUser $_ -Company '' -Credential $cred}
If I run
Get-QADUser -SiteLimit 13000 | where {$_.Company} | % {Write-Host $_.name $_.company}
I get the group of AD records I want to blank out the Company field. When I try to do the set-qaduser I get an error:
Set-QADUser : Value does not fall within the expected range. At line 1 char 68
Char 68 is the space between Set_QADUser & $_
Code I'm using:
$cred = Get-Credential
Get-QADUser -SiteLimit 13000 | where {$_.Company} | % {Set-QADUser $_ -Company '' -Credential $cred}
set-qaduser error
I am not trying to hi-jack the thread, but I am a little confused about something what does the:
| where {$_.Company} | do ?
I am thinking it is a compare but to what? is it saying where company has a value?
| where {$_.Company} | do ?
I am thinking it is a compare but to what? is it saying where company has a value?
set-qaduser error
The $_.Company is clearly an error in coding as teh "weher" cmdlet can't take a null filter argument. If the arg is not nul it acts as if the "where" cmdlet is not there as it will pass everything down the pipe.
If teh value is NULL it will throw a terminating error.
The error is being caused by a null value being passed as "$_" to teh Set cmdlet. The $_ is at position 68 in the line.
If teh value is NULL it will throw a terminating error.
The error is being caused by a null value being passed as "$_" to teh Set cmdlet. The $_ is at position 68 in the line.