Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

how to know if an ADoject is missing

60 views
Skip to first unread message

Jean-Luc TUAL

unread,
Apr 12, 2013, 7:29:38 AM4/12/13
to
I must modify attributs of ADojects,
My script run fine with a input csv file but several objets are missing,
i want know them

example :
i search all adobjets begin by 7

> get-adobject -filter {CN -like "7*"} -searchbase "OU=test,DC=test,DC=fr"

result

DistinguishedName Name ObjectClass ObjectGUID
----------------- ---- ----------- ----------
CN=7377,OU=test,DC=test... 7377 contact 4b2679bf-728
CN=7379,OU=test,DC=test... 7379 contact de09b07c-250

Object 7378 doesn't exist

> get-adobject -filter {CN -like "7378"} -searchbase "OU=test,DC=test,DC=fr"

result
nothing

J�rgen Exner

unread,
Apr 12, 2013, 9:16:36 AM4/12/13
to
On Fri, 12 Apr 2013 04:29:38 -0700 (PDT), Jean-Luc TUAL
<jeanlu...@gmail.com> wrote in microsoft.public.windows.powershell:

>I must modify attributs of ADojects,
>My script run fine with a input csv file but several objets are missing,
>i want know them
>
>example :
>i search all adobjets begin by 7
>
>> get-adobject -filter {CN -like "7*"} -searchbase "OU=test,DC=test,DC=fr"

Looks like get-adobject is not a common Powershell command:

PS C:\Users\jue> get-adobject
The term 'get-adobject' is not recognized as the name of a cmdlet,
function, script file, or operable program.
PS C:\Users\jue> get-help get-adobject
Get-Help : Cannot find Help for topic "get-adobject"

>result
>
>DistinguishedName Name ObjectClass ObjectGUID
>----------------- ---- ----------- ----------
>CN=7377,OU=test,DC=test... 7377 contact 4b2679bf-728
>CN=7379,OU=test,DC=test... 7379 contact de09b07c-250
>
>Object 7378 doesn't exist
>
>> get-adobject -filter {CN -like "7378"} -searchbase "OU=test,DC=test,DC=fr"
>
>result
>nothing

Well, that 's not surprising. Although there is no way to know what
-filter actually does (the command is not a standard PowerShell command,
therefore we know nothing about it), the parameter name -filter
indicates that probably you are filtering for something. And if this
element doesn't exit then the result of the filter process will be
empty. That's to be expected.

The same would probably happen if you filter for 5, 123412341234, or
"HelloWorld". Those most likely don't exist, either.

Therefore, coming back to your original question about "I want to know
[the missing object]": first you need to define which objects you are
expecting to exist. And nobody here can know what those should be. After
you know those, then you can use compare-object do compare the expected
list against the actual list and determine any differences.

jue

Jean-Luc TUAL

unread,
Apr 15, 2013, 4:44:23 AM4/15/13
to
The command Get-adobjects exists with module ActiveDirectory

my script begins import-module ActiveDirectory
0 new messages