30 October 2013

Register Schema Console

if you need to use schema console you need to first register the console:

run in a elevated command prompt:

regsvr32 C:\Windows\System32\schmmgmt.dll

after that you can lunch the mmc then from the File menu click Add / Remove Snap-in, select in the right window Active Directory Schema and click Add and then OK.

18 October 2013

Script prerequisites

if you need to ensure your script with powershell minimum version, loaded module, PSSnapin you can use the #Requires statement :

#Requires -Version 3.0
#Requires -Modules ActiveDirectory


08 October 2013

Find method details


'a' | Get-Member Split | Format-List



Send mail message from powershell


Send-MailMessage -From "user@domain.com" -To "user@domain.com" -Subject "subject" -Body "Message" -SmtpServer servername.local


or by using splatting:


$body = "body message"

$email = @{
From = "user@domain.com"
To = "user@domain.com"
Subject = "subject"
SMTPServer = "servername.local"
Body = $body
}

Send-MailMessage @email