Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Powershell slow

Closed Thread
 
Thread Tools Display Modes
Old 04-10-2008   #11 (permalink)
Swamy Channaveera
Guest


 

Re: Powershell slow

$user = [ADSI]"WinNT://ud1/jordd03"
$user | get-member

The above get-member displays only the default attributes, how the get the
complete list of attributes from the get-member command



"Swamy Channaveera" wrote:
Quote:

> Hi,
>
> when i run
> $user = [ADSI]"WinNT://ud1/jordd03"
> $user | get-member
>
> I see properties name quite different when i use get-qaduser. instead of
> displayname it's FullName, but there is no attribute as altrecipient !!!
>
> regards,
>
>
>
>
>
> "Swamy Channaveera" wrote:
>
Quote:

> > Hi,
> >
> > I tryed the following command
> >
> > get-content user.txt | foreach {[ADSI]"WinNT://UD1/$_"}
> >
> > where UD1 is the netbios name of the domain. The output is blank with the
> > error message
> >
> > distinguishedName
> > --------------------
> >
> >
> >
> > out-lineoutput : exception retrieving member "Classidd2e4...... ": unknown
> > error (0x80005000)"
> >
> > Regards,
> >
> >
> >
> > "Karl Mitschke" wrote:
> >
Quote:

> > > Hello Swamy,
> > >
> > > > The script is as follows
> > > >
> > > > get-content user.txt | foreach { get-qaduser $-} | sort altrecipient |
> > > > select-object displayname, altrecipient | convertto-html list.htm
> > > >
> > > > Regards,
> > > >
> > >
> > > Swamy;
> > >
> > > Try this and see if is any faster. If it is we can work on getting the data
> > > out the way you want:
> > >
> > > get-content user.txt | foreach {[ADSI]"LDAP://$_"} | sort altrecipient |
> > > select-object displayname, altrecipient
> > >
> > >
> > >
Old 04-10-2008   #12 (permalink)
Karl Mitschke
Guest


 

Re: Powershell slow

Hello Swamy,
Quote:

> Hi,
>
> I tryed the following command
>
> get-content user.txt | foreach {[ADSI]"WinNT://UD1/$_"}
>
> where UD1 is the netbios name of the domain. The output is blank with
> the error message
>
> distinguishedName
> --------------------
> out-lineoutput : exception retrieving member "Classidd2e4...... ":
> unknown error (0x80005000)"
>
> Regards,
>
Swamy;

What happens when you run the one-liner I suggested?

get-content user.txt | foreach {[ADSI]"LDAP://$_"} | sort altrecipient |
select-object displayname, altrecipient


Old 04-10-2008   #13 (permalink)
Brandon Shell [MVP]
Guest


 

Re: Powershell slow

That is inefficient

Try This

foreach($user in (get-content user.txt)){get-qaduser $user -IncludedProperties
altrecipient,DisplayName | select-object displayname,altrecipient}


This is with 1000 users

101# measure-command {foreach($user in (get-content user.txt)){get-qaduser
-ldap "(&(objectcategory=user)(samAccountName=$user))"
-IncludedProperties altrecipient,DisplayName | select-object displayname,altrecipient
| sort altrecipient | out-null}}

Days : 0
Hours : 0
Minutes : 0
Seconds : 38
Milliseconds : 927
Ticks : 389279822
TotalDays : 0.000450555349537037
TotalHours : 0.0108133283888889
TotalMinutes : 0.648799703333333
TotalSeconds : 38.9279822
TotalMilliseconds : 38927.9822

Outputting to file

102# measure-command {foreach($user in (get-content user.txt)){get-qaduser
-ldap "(&(objectcategory=user)(samAccountName=$user))"
-IncludedProperties altrecipient,DisplayName | select-object displayname,altrecipient
| sort altrecipient | convertTo-html | out-file list.html}}

Days : 0
Hours : 0
Minutes : 0
Seconds : 54
Milliseconds : 435
Ticks : 544358147
TotalDays : 0.00063004415162037
TotalHours : 0.0151210596388889
TotalMinutes : 0.907263578333333
TotalSeconds : 54.4358147
TotalMilliseconds : 54435.8147

The way you posted could have issues if the user is not found or blank as
it will parse the entire directory. With a filter you get an exact match.
This is because get-qaduser treats -id as a wild card. In my case I couldn't
even get it to finish because I have 100s of thousands of users.


Brandon Shell
---------------
Blog: http://www.bsonposh.com/
PSH Scripts Project: www.codeplex.com/psobject

SC> The script is as follows
SC>
SC> get-content user.txt | foreach { get-qaduser $-} | sort altrecipient
SC> | select-object displayname, altrecipient | convertto-html list.htm
SC>
SC> Regards,
SC>
SC> "Brandon Shell [MVP]" wrote:
SC>
Quote:
Quote:

>> Can you show me the code your using? Are you using a LDAP filter?
>>
>> "Swamy Channaveera" <SwamyChannaveera@xxxxxx>
>> wrote in message
>> news:41A5C65E-985D-4620-B58D-BF2C06943146@xxxxxx
>>
Quote:

>>> Hi,
>>>
>>> I'm using get-qaduser to get some of the attributes from AD. The
>>> script
>>> reads a text filee and extracts some of the attributes and writes to
>>> the
>>> csv
>>> files. The execution takes a long time. I'm querying for only 35
>>> users max
>>> it
>>> takes around 45sec to 1 min to get the info and write it to csv
>>> file.
>>> Where
>>> as a VBScript hardly takes 10 sec!!!!
>>> I have another script which checks wheter the Homemdb attribute
>>> exists and writes some of the attributes to the csv files. The
>>> execution takes a long time about 1 hours for 17,000 users.
>>>
>>> I'm running the script on XP mahcine with 512 MB ram. Any suggestion
>>> to improve the execution would be appriciated.
>>>
>>> Regards,
>>> Swamy

Old 04-10-2008   #14 (permalink)
Brandon Shell [MVP]
Guest


 

Re: Powershell slow

The problem here, I am guessing is the way that Quest processes the entries.
I would talk to them first.

p.s. Should ask for the ability to pass a text file or array directly to
get-qaduser
get-qaduser -file user.txt
or
get-qaduser -id (get-content user.txt)

"Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
news:urGGJ7wmIHA.5956@xxxxxx
Quote:

> Swamy Channaveera wrote:
Quote:

>> The script is as follows
>>
>> get-content user.txt | foreach { get-qaduser $-} | sort altrecipient |
>> select-object displayname, altrecipient | convertto-html list.htm
>
> And how about the VBScript version also. Maybe there's something we can
> pass along to MS on this for them to look into...
>
> Marco
>
>
> --
> Microsoft MVP - Windows PowerShell
> http://www.microsoft.com/mvp
>
> PowerGadgets MVP
> http://www.powergadgets.com/mvp
>
> Blog:
> http://marcoshaw.blogspot.com
Old 04-10-2008   #15 (permalink)
Brandon Shell [MVP]
Guest


 

Re: Powershell slow

I explained this in a different part of this thread.
"Swamy Channaveera" <SwamyChannaveera@xxxxxx> wrote in
message news:C5A81461-A787-4498-BB7B-44636EE20DEE@xxxxxx
Quote:

> Hi,
>
> when i run
> $user = [ADSI]"WinNT://ud1/jordd03"
> $user | get-member
>
> I see properties name quite different when i use get-qaduser. instead of
> displayname it's FullName, but there is no attribute as altrecipient !!!
>
> regards,
>
>
>
>
>
> "Swamy Channaveera" wrote:
>
Quote:

>> Hi,
>>
>> I tryed the following command
>>
>> get-content user.txt | foreach {[ADSI]"WinNT://UD1/$_"}
>>
>> where UD1 is the netbios name of the domain. The output is blank with
>> the
>> error message
>>
>> distinguishedName
>> --------------------
>>
>>
>>
>> out-lineoutput : exception retrieving member "Classidd2e4...... ":
>> unknown
>> error (0x80005000)"
>>
>> Regards,
>>
>>
>>
>> "Karl Mitschke" wrote:
>>
Quote:

>> > Hello Swamy,
>> >
>> > > The script is as follows
>> > >
>> > > get-content user.txt | foreach { get-qaduser $-} | sort altrecipient
>> > > |
>> > > select-object displayname, altrecipient | convertto-html list.htm
>> > >
>> > > Regards,
>> > >
>> >
>> > Swamy;
>> >
>> > Try this and see if is any faster. If it is we can work on getting the
>> > data
>> > out the way you want:
>> >
>> > get-content user.txt | foreach {[ADSI]"LDAP://$_"} | sort altrecipient
>> > |
>> > select-object displayname, altrecipient
>> >
>> >
>> >
Old 04-10-2008   #16 (permalink)
Karl Mitschke
Guest


 

Re: Powershell slow

Hello Brandon Shell [MVP],
Quote:

> The problem here, I am guessing is the way that Quest processes the
> entries. I would talk to them first.
>
> p.s. Should ask for the ability to pass a text file or array directly
> to
> get-qaduser
> get-qaduser -file user.txt
> or
> get-qaduser -id (get-content user.txt)
> "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com> wrote in message
> news:urGGJ7wmIHA.5956@xxxxxx
>
Quote:

>> Swamy Channaveera wrote:
>>
Quote:

>>> The script is as follows
>>>
>>> get-content user.txt | foreach { get-qaduser $-} | sort altrecipient
>>> | select-object displayname, altrecipient | convertto-html list.htm
>>>
Thats why I wanted Swamy to test using ADSI

Karl


Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows Live Mail hogging CPU – renders itself and XP into slow, slow, slow mode . . . Stan Shankman Live Mail 6 07-10-2008 03:13 PM
Powershell is slow Tim Munro PowerShell 10 01-24-2008 03:05 AM
PowerShell PAINFULLY SLOW across network mario PowerShell 5 02-16-2007 04:57 PM
Vista Windows are (Not Responding) - Slow Slow Slow JB1300 Vista General 2 02-11-2007 10:29 AM
Slow performance initializing PowerShell from managed code =?Utf-8?B?ZGg=?= PowerShell 6 09-05-2006 02:39 PM








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50