http://technet.microsoft.com/library/hh849720.aspx In PowerShell v3 don't forget the occasional Update-Help
Best to do so under a PowerShell launched with admin credentials Steven Peck http://www.blkmtn.org On Wed, Jan 23, 2013 at 3:46 PM, Damien Solodow <[email protected] > wrote: > Huh; I usually just put the cmdlet name (and parameter if necessary) > into Google and get good results. > Although get-help from within PowerShell works well. ;) The -detailed and > -online switches are very helpful. > In PowerShell 3.0, the -OutWindow is very handy for get-help > > > DAMIEN SOLODOW > Systems Engineer > 317.447.6033 (office) > 317.447.6014 (fax) > HARRISON COLLEGE > ------------------------------ > *From:* Steven Peck [[email protected]] > *Sent:* Wednesday, January 23, 2013 6:40 PM > > *To:* NT System Admin Issues > *Subject:* Re: Help with this script > > I tend to find better results for PowerShell cmdlets in BING. Of > course, that just may be the way I search. > > On Wed, Jan 23, 2013 at 3:08 PM, Heaton, Joseph@Wildlife < > [email protected]> wrote: > >> Thanks guys. I did google parameter SearchScope but didn’t get any >> useful info.**** >> >> ** ** >> >> *From:* Webster [mailto:[email protected]] >> *Sent:* Wednesday, January 23, 2013 2:10 PM >> >> *To:* Heaton, Joseph@Wildlife; NT System Admin Issues >> *Subject:* RE: Help with this script**** >> >> ** ** >> >> http://technet.microsoft.com/en-us/library/ee617236.aspx**** >> >> ** ** >> >> [-SearchScope {<Base> | <OneLevel> | <Subtree>}]**** >> >> ** ** >> >> ** ** >> >> Thanks**** >> >> ** ** >> >> ** ** >> >> Webster**** >> >> ** ** >> >> *From:* Heaton, Joseph@Wildlife >> [mailto:[email protected]<[email protected]>] >> >> *Sent:* Wednesday, January 23, 2013 3:58 PM >> *To:* NT System Admin Issues >> *Subject:* RE: Help with this script**** >> >> ** ** >> >> Are OneLevel and SubTree the only options for the SearchScope parameter?* >> *** >> >> ** ** >> >> *From:* Damien Solodow >> [mailto:[email protected]<[email protected]>] >> >> *Sent:* Wednesday, January 23, 2013 1:18 PM >> *To:* Heaton, Joseph@Wildlife; NT System Admin Issues >> *Subject:* RE: Help with this script**** >> >> ** ** >> >> Yep.**** >> >> The line $OUlist = @(Get-ADOrganizationalUnit -filter * -Credential >> $cred -SearchBase $domain.distinguishedName -SearchScope OneLevel -Server >> $domain.DNSroot)**** >> >> ** ** >> >> Change OneLevel to SubTree**** >> >> ** ** >> >> DAMIEN SOLODOW**** >> >> Systems Engineer**** >> >> 317.447.6033 (office)**** >> >> 317.447.6014 (fax)**** >> >> HARRISON COLLEGE**** >> >> ** ** >> >> *From:* Heaton, Joseph@Wildlife >> [mailto:[email protected]<[email protected]>] >> >> *Sent:* Wednesday, January 23, 2013 4:14 PM >> *To:* NT System Admin Issues >> *Subject:* Help with this script**** >> >> ** ** >> >> I found this script, to count user objects in all OUs. The report >> doesn’t list all OUs, so I was wondering if anyone could tell me if it has >> a limit as to how deep it will go to count.**** >> >> ** ** >> >> Here’s the script:**** >> >> ** ** >> >> Import-Module activeDirectory**** >> >> ** ** >> >> $fqdn = Read-Host "Enter FQDN domain"**** >> >> $cred = Get-Credential**** >> >> ** ** >> >> Write-Host "Contacting $fqdn domain..." -ForegroundColor Yellow**** >> >> ** ** >> >> $domain = (get-addomain $fqdn -Credential $cred | select >> distinguishedName,pdcEmulator,DNSroot,DomainControllersContainer)**** >> >> ** ** >> >> Write-Host "Completed. Enumerating OUs.." -ForegroundColor Yellow**** >> >> ** ** >> >> $OUlist = @(Get-ADOrganizationalUnit -filter * -Credential $cred >> -SearchBase $domain.distinguishedName -SearchScope OneLevel -Server >> $domain.DNSroot)**** >> >> Write-Host "Completed. Counting users..." -ForegroundColor Yellow**** >> >> ** ** >> >> for($i = 1; $i -le $oulist.Count; $i++)**** >> >> {write-progress -Activity "Collecting OUs" -Status "Finding OUs $i" >> -PercentComplete ($i/$OUlist.count*100)}**** >> >> $newlist = @{}**** >> >> ** ** >> >> ** ** >> >> ** ** >> >> foreach ($_objectitem in $OUlist)**** >> >> {**** >> >> $getUser = Get-ADuser -Filter * -Credential $cred -SearchBase >> $_objectItem.DistinguishedName -SearchScope Subtree -Server >> $domain.pdcEmulator | measure | select Count**** >> >> for($i = 1; $i -le $getUser.Count; $i++)**** >> >> {write-progress -Activity "Counting users" -Status "Finding users $i >> in $_objectitem" -PercentComplete ($i/$getUser.count*100)}**** >> >> **** >> >> $newlist.add($_objectItem.Name, $getUser.Count) **** >> >> }**** >> >> ** ** >> >> $newlist > .\OUuserCount.txt **** >> >> ** ** >> >> Write-Host "All done!" -ForegroundColor yellow **** >> >> ** ** >> >> ** ** >> >> So, the report that it creates only lists top level OUs under the >> domain. I think it does, however, dig down under that to get the count, >> but just wanted to make sure.**** >> >> ** ** >> >> Thanks,**** >> >> ** ** >> >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ >> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >> >> --- >> To manage subscriptions click here: >> http://lyris.sunbelt-software.com/read/my_forums/ >> or send an email to [email protected] >> with the body: unsubscribe ntsysadmin**** >> >> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ >> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ >> >> --- >> To manage subscriptions click here: >> http://lyris.sunbelt-software.com/read/my_forums/ >> or send an email to [email protected] >> with the body: unsubscribe ntsysadmin >> > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to [email protected] > with the body: unsubscribe ntsysadmin > > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ > ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ > > --- > To manage subscriptions click here: > http://lyris.sunbelt-software.com/read/my_forums/ > or send an email to [email protected] > with the body: unsubscribe ntsysadmin > ~ Finally, powerful endpoint security that ISN'T a resource hog! ~ ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/> ~ --- To manage subscriptions click here: http://lyris.sunbelt-software.com/read/my_forums/ or send an email to [email protected] with the body: unsubscribe ntsysadmin
