08 January 2013

Retrieve computer manufacturer and model

WMI class Win32_ComputerSystem has information about computer hardware manufacturer and computer model:

Get-WmiObject -Class Win32_ComputerSystem


Manufacturer     : Dell Inc.
Model               : OptiPlex 740 Enhanced

Get-WmiObject can also be used to retrieve this information from remote computers:

Get-WmiObject -Class Win32_ComputerSystem -ComputerName computer_name

03 January 2013

LDAP syntax

LDAPFilter parameter of the Get-ADuser cmdlet is much easy to use an type;

One LDAPFilter conditions is enclosed in parenthesis and an operator will precede two conditions:

Eg. ( & (condition one) (condition two) ) - translate as condition one AND condition two

( | (condition one) (condition two) ) - translate as condition one OR condition two

 Logical conditions are formed using Active Directory attributes names like objectClass, objectCategory, name.

Eg.: to search for all users whose name start with "z" we will use:
(&(objectcategory=person)(name=z*))


 Get-ADUser -LDAPFilter {(&(objectCategory=person)(name=z*))}

It is recomended to use objectCategory instead of objectClass when ever possible because objectClass attribute can have multiple values and objectCategory is an indexed attribute in Active Directory and will speed up the search.


02 January 2013

Powershell 3 help files

Powershell 3 ( or Windows Management Framework 3 ) does not contain help files so if you need local help about cmdlets you will need to update your help files;

Update-Help is the cmdlet that will update your help files; you need to run your powershell with elevated rights (Run As Administrator).

Keep in mind that your user interface language setting will be used when help files are updated and the content of the files will be in your locale language;

You can also use the "-UICulture" parameter to specify for what language to download or update help files;