Create PS Credential from Strings
$Username = 'Username' $Password = 'Password' $SecureString = ConvertTo-SecureString $Password -AsPlainText -Force $Credential = New-Object System.Management.Automation.PSCredential $Username, $SecureString
Find characters between single quotes ‘
$string = "'LastName', ([samaccountname])" [Regex]::Matches($string, "(?
Convert Between Time Zones
$DateTime = [DateTime]::SpecifyKind($date, [DateTimeKind]::Unspecified) $from = [System.TimeZoneInfo]::FindSystemTimeZoneById($FromTimeZone) $to = [System.TimeZoneInfo]::FindSystemTimeZoneById($ToTimeZone) $utc = [System.TimeZoneInfo]::ConvertTimeToUtc($DateTime, $from) [System.TimeZoneInfo]::ConvertTime($utc, $to)
Search for a Time Zones
[System.TimeZoneInfo]::GetSystemTimeZones() | Where-Object{$_.DisplayName -like "*$($Name)*" -or $_.DaylightName -like "*$($Name)*" -or $_.StandardName -like "*$($Name)*" -or $_.Id -like "*$($Name)*"}
DateTime to Year Quater
"$($date.Year)$("{0:00}" -f [Math]::ceiling($date.Month/3) )"