I love this job. I’m
not only talking about what I do in the civilian world as an IT Trainer, but
also as a Navy Chief Petty Officer. I received
a Facebook message from a Marine at Camp Pendleton a few nights ago in need of
some assistance with PowerShell. Below is his line of code and his error
Get-User -organizationalunit
test.local.net/users -RecipentTypeDetails
Get-ADUser : A parameter cannot be found that matches parameter name
'organizationalunit'.
At line:1 char:12
+ Get-ADUser -organizationalunit PowerIT.com/users
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Get-ADUser],
ParameterBindingException
+ FullyQualifiedErrorId :
NamedParameterNotFound,Microsoft.ActiveDirectory.Management.Commands.GetADUser
Being both a PowerShell enthusiast and a Navy Chief, I
helped him see what was wrong with his code, but I also had to correct his bad habits.
The error on Get-ADUser is because there is not an
–OrganizationalUnit parameter. (there is also not a –RecipentTypeDetails parameter.)
I directed him to look up the help file for Get-ADUser and I gave him
the address (https://technet.microsoft.com/en-us/library/ee617241.aspx). I even told him the correct parameter name, –SearchBase.
The root cause of the error is this Marine is have is “assuming”
parameter names and not actually looking them up. I find this in every PowerShell class that I
teach. Despite the first lesson of each
class explains how to prevent you from making this mistake, someone always
does. Never assume a parameter is
present. Check the help file for the
Cmdlet being used and verify.
The correction came when he did the same thing again for his
next cmdlet. PowerShell is an incredible technology, but if you are not willing
to read the help files, do not work in this Chief’s work center. Reading the help files is not an option, but
a requirement to effectively utilize PowerShell.
Comments