How filter is written in PowerShell for Exchange

Source: Internet
Author: User

This article briefly discusses the use of filter in the PowerShell of exchange, but I believe that the classmate may not use it after reading it ..... That said, but after all is a new choice, you can learn.

First we look at an output, and we look at what properties can be filtered in Exchange2010 Get-user [ps] e:\>get-user zhangpengliang|select * Creating a new session to implicitly remoting the "get-user" command ... runspaceid               :  2429e504-c00b-4f51-8725-a65e35221181issecurityprincipal      :  Truesamaccountname           : zhangpengliangsid                        : S-1-5-21-2564635362-2982989232-1758174225-30968SidHistory                : {}UserPrincipalName         : [email protected]ResetPasswordOnNextLogon :  falsecertificatesubject       : {}remotepowershellenabled  :  truewindowsliveid            :netid                     : Useraccountcontrol       : passwordnotrequired, normalaccount,  donotexpirepasswordorganizationalunit       : tech.xxxx.com/ IT Support Department islinked                  : FalseLinkedMasterAccount      :AssistantName             :City                      :Company                   : xxxxcountryorregion           :D epartment                : xdirectreports            :  {}DisplayName              :  Zhangpengliang fax                       :FirstName                 :  Peng Liang homephone                 :Initials                  :LastName                  :  Zhang manager                   : tech.xxxx.com/xxxxxxxxmobilephone               : 15134234Notes                     :Office                    :  Xxx-xxx-it Support Department otherfax                  : {}otherhomephone           :  {}OtherTelephone           : {}Pager                      :P hone                     : 0000phoneticdisplayname      :P ostalcode                :P ostofficebox             : {}RecipientType             : usermailboxrecipienttypedetails     : usermailboxsimpledisplayname         :StateOrProvince           :  Beijing streetaddress             :Title                     :  Maintenance Engineer umdialplan                :UMDtmfMap                 : {emailaddress:975, reversedphone:0000, reversedphone:23879001151, lastnamefirstname:,  firstn                            ameLastName:}AllowUMCallsFromNonUsers :  searchenabledwebpage                   :TelephoneAssistant       :WindowsEmailAddress       : [email protected]UMCallingLineIds          : {}SeniorityIndex            :VoiceMailSettings        : {}IsValid                   :  Trueexchangeversion          : 0.10  (14.0.100.0) name                      :  Zhangpengliang distinguishedname        : cn= Zhang Peng Liang, ou= company, DC=tech,DC=xxxx,DC= comidentity                  : tech.xxxx.com/xxxxx/Zhangpengliang guid                      :  45fd2d82-cee5-49f7-bf3a-5d2cf93923efobjectcategory            : tech.xxxx.com/Configuration/Schema/PersonObjectClass               : {top, person, organizationalperson, user} Whenchanged              : 2015/7/13 15:07:38whencreated               : 2011/5/20 17:50:05WhenChangedUTC            : 2015/7/13 7:07:38WhenCreatedUTC            : 2011/5/20 9:50:05OrganizationId            :OriginatingServer        :  IDCDC01.tech.xxxx.com

A lot of stuff, right? In general, to screen specific users or specific information, my practices and habits are piped. But the pipeline has one of the biggest problems: "inefficient".

Microsoft affirms that Get-user supports the use of the filter method to query. What is a filter query?

To be exact, the use of this is actually still improved after the Opath query.

650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6F/F1/wKioL1WuDXaS612cAACqEmrCrY4292.jpg "title=" 2015-7-21 17-01-12.jpg "alt=" Wkiol1wudxas612caacqemrcry4292.jpg "/>

We have to look at the wording, we can see the wording is very human, from the reading sense, close to natural language.



650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M02/6F/F4/wKiom1WuDCqjcYTpAAHvtrZa17g601.jpg "title=" 2015-7-21 17-08-18.jpg "alt=" Wkiom1wudcqjcytpaahvtrza17g601.jpg "/>


Some people may think that this is already very complex ah, how can be simple, but you know how LDAP query a user named AA what is it?

(& (& | ( & (Objectcategory=person) (objectsid=*) (!samaccounttype:1.2.840.113556.1.4.804:=3)) (& (objectcategory= person) (!objectsid=*)) (& (Objectcategory=group) (anr=aa*)))


See the above query bird look, you still think Opath filter trouble?

In addition, the actual test, filter is not very useful, perhaps I have limited technical level, the query when the results can not be, but the pipeline is no problem.

such as this sentence, can be queried out of no problem

get-user-organizationalunit tech.xxxx.com-filter {title-like ' * manager * '}

But there's a problem with this, and I can't find it.

Get-user-organizationalunit xxxx-filter{distinguishedname-like ' * Support * '}


It looks similar, but it's a lot more complicated than plumbing. In the pipeline can not help, we have a new choice, but the pipeline to use the time, generally still use pipe bar ~

This article is from the "Nine uncle-Microsoft Private Cloud" blog, please make sure to keep this source http://jiushu.blog.51cto.com/972756/1676800

How filter is written in PowerShell for Exchange

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.