29 May 2014

Forefront Identity Manager criteria group wildcard characters

%   Any string of zero or more characters.
_ (underscore)   Any single character.
[ ]   Any single character within the specified range ([a-f]) or set ([abcdef]).
[^]   Any single character not within the specified range ([^a-f]) or set ([^abcdef]).

source

26 May 2014

System.DirectoryServices.ActiveDirectory Namespace


[ActiveDirectory.Forest]
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Name
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().ApplicationPartitions
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Sites
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().GlobalCatalogs
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Domains
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().ForestMode
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().RootDomain
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().Schema
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().SchemaRoleOwner
[System.DirectoryServices.ActiveDirectory.Forest]::GetCurrentForest().NamingRoleOwner

[Active Directory Domain]:


GetCurrentDomain() can be switch with GetComputerDomain()
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().InfrastructureRoleOwner
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().PdcRoleOwner
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().RidRoleOwner
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainControllers
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainMode
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Parent
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().DomainMode
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Children
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Forest
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name

[Computer Specific]:
[System.DirectoryServices.ActiveDirectory.ActiveDirectorySite]::GetComputerSite()
[System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain().Name
[System.DirectoryServices.ActiveDirectory.Domain]::GetComputerDomain().Name

23 May 2014

User must change password at next logon - active directory attribute

pwdLastSet attribute is set to zero to force the user to change their password at next logon.

set the pwdLastSet attribute to -1 to remove this requirement.

22 May 2014

Use the output of query and run scheduled tasks from a remote computer in powershell



the output will be formated in a csv format and can be assigned to a variable and interpreded:

$taskQuery = schtasks /Query /S computer_name /TN task_name /V /FO CSV

$taskQuery[1].split(',')[3]  - will output:

"Ready"

Export exchange message tracking results in csv

default output of Export-CSV command for the output of Get-MessageTrackingLog will not show all properties in the correct format:


Recipients RecipientStatus
System.String[] System.String[]


Select-Object can be used to properly format the output for the Export-CSV command:


Select-Object Timestamp, Sender, {$_.Recipients}, {$_.RecipientStatus}