Microsoft vient de publier un guide rapide des commandes PowerShell. Celui traite les points suivants:
How to Access Arguments – How to Use Colored Text – How to Insert a Paragraph Return – How to Write in Reverse Video – How to Insert Comments – How to Create Multi-Command Lines – How to Make Comparisons – How to Insert Line Breaks – How to Solicit Input – How to Read a Text File – How to Write to a Text File – How to Write Conditional Statements – How to Write For and For Each Loops – How to Write Do Loops – How to Print Data – How to Create a COM Object – How to Create a .NET Object – How to Select Properties – How to Sort Data – How to Work with WMI – How to Bind to Active Directory – How to Bind to Local Accounts – How to Get Help – How to Change Security Settings – How to “Interrogate” an Object – How to Clear the Console Window
To bind to an Active Directory account use the LDAP provider: $a = [adsi] "LDAP://cn=kenmyer, ` ou=Finance, dc=fabrikam, dc=com" Listing all the objects in an OU is a little more complicated; however, one relatively easy way to accomplish this task is to bind to the OU and then use the PSBase_GetChildren() method to retrieve a collection of items stored in that OU: $objOU = [ADSI]` "LDAP://ou=Finance,dc=fabrikam,dc=com" $users = $objOU.PSBase.Get_Children() $users | Select-Object displayName
Vous pouvez retrouver ce guide sur le site Microsoft