How to avoid Get-QADUser queries to return multiple property strings with PowerShell 2.0 -


i using get-qaduser , .directoryentry.firstname in powershell 2.0 make multiple ldap queries , return strings. these multiple calls slow. how make 1 get-qaduser ldap query , create strings select properties.

example:

    add-pssnapin quest.activeroles.admanagement     $searchdomainfrom = 'domain.net/oupath/users'     $user = username      $firstname = (get-qaduser -searchroot $searchdomainfrom $user).directoryentry.firstname     $lastname = (get-qaduser -searchroot $searchdomainfrom $user).directoryentry.lastname     $email = (get-qaduser -searchroot $searchdomainfrom $user).directoryentry.email     $supervisor = (get-qaduser -searchroot $searchdomainfrom $user).directoryentry.manager     $officelocation = (get-qaduser -searchroot $searchdomainfrom $user).directoryentry.office     $phonenumber = (get-qaduser -searchroot $searchdomainfrom $user).directoryentry.phonenumber 

just make query once , gets strings object that's returned first time.

$current = get-qaduser -searchroot $searchdomainfrom $user $firstname = $current.directoryentry.firstname $lastname = $current.directoryentry.lastname $email = $current.directoryentry.email $supervisor = $current.directoryentry.manager $officelocation = $current.directoryentry.office $phonenumber = $current.directoryentry.phonenumber 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -