Do you know what is the difference between Get-QADComputer A2101 and Get-QADComputer -Name A2101?
When we were designing Quest AD cmdlets we did our best to be as forgiving as possible. So for example you can just do Get-QADUser and get the first 1000 user objects (or whatever is the default number you set) retrieved. Or you can just do a Get-QADUser Dmitry and get all the Dmitry’s you have in your organizations (if you have any
)
In most cases, this forgiving nature is what you are in the command-line interactively managing your Active Directory. If you have ever tried using some other snapins/modules from other vendors who went a different route – you should have noticed how much difference this makes.
However, sometimes you do want to be explicit and just get the exact object you want and not just whatever matches. In this forum thread Jason was trying to update a set of computer records based on a CSV file he was importing.
Unfortunately for him, some of computer names in his environment include other names. E.g. he not only has a computer called ‘A2101′, but also ‘A21012′ and ‘A21013′.
Which means that Get-QADComputer A2101 returns all three of those:
a2101
a21012
a21013
Jason obviously did not need the other two computers and explicitly wanted to update just the one which matches exaqctly.
Luckily the workaround is very simple. If you know what you need – be explicit when you are asking for it. For example, if the you are identifying the computer by its Name - just tell us so and if no wildcards are used we will only retrieve the exact match:
Get-QADComputer -Name A2101 only returns one computer record with Name being A2101.
Happy scripting!
Like this:
Be the first to like this post.