Szukaj na tym blogu

piątek, 24 października 2014

Exchange 2013 DNS high availability best practices

Change internal and external URL for all virtual directories to the name of loadbalancer of CNAME DNS record (round robin), e.g.
mail.ocean.com



Then in powershell
Get-ClientAccessServer -id *2013* | fl *uri
Get-ClientAccessServer -id *2013* | set-ClientAccessServer -autodiscoverServiceInternalUri https://autodoscover.ocean.com/autodoscover/autodoscover.xml

This configures SCP (service connection point in AD)

For external autodiscover You should create DNS record that point to loadbalancer CNAME DNS record (round robin)

czwartek, 23 października 2014

PowerShell display SCOM warnings generated by specific rule

These below are for only one specific computer *011sql* :
Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFullName -eq "Microsoft.SystemCenter.HealthService:SCOM_name.ocean.com" -AND $_.Description -like "*011sql*")} | select -ExpandProperty Description

And below I want to remove some text from the Description filed to get only computer name for the description field:
(((Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFull
Name -eq "Microsoft.SystemCenter.HealthService:SCOM.ocean.com" -AND $_.Description -like "*011sql*")}
 | select -ExpandProperty Description | Out-String).trim("Computer verification failure for Machine Name:")).Trim()).Trim(" is 0x800706BA. The RPC server is unavailable.")




This below is for all computers:
(Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFullNa
me -eq "Microsoft.SystemCenter.HealthService:SCOM.ocean.com" )} | select -ExpandProperty Description | Out-String) | foreach {$_ -replace "Computer verification failure for Machine Name: " -replace " is 0x800706BA.*"} >> scomWarComps.txt

Resolve all this specific warnings using below script:
$comps = gc scomWarComps.txt
foreach ($e in $comps) {
Get-SCOMAlert -criteria 'ResolutionState = "0" AND Severity = "1"'| where-object{($_.MonitoringObjectFullName -eq "Microsoft.SystemCenter.HealthService:SCOM.ocean.com" -AND $_.Description -like "*$e*")} | set-SCOMAlert -ResolutionState 255
}

poniedziałek, 20 października 2014

Get all computers with IIS role installed using SCOM

Get-SCOMGroup -DisplayName "IIS 2003 c*" | Get-SCOMClassInstance | sort displayname | select -ExpandProperty displayname

Or using ServerManager module
Get-ADComputer  -SearchBase "OU=Windows Servers V2,OU=Servere,DC=ocean,DC=com" -filter * | format-table Name >> server_list.txt

$comp = gc "server_list.txt"
foreach ($entry in $comp) {
 write-host $entry
 Get-WindowsFeature -ComputerName $entry -Name "Web-Server" -ErrorAction SilentlyContinue
}


This one below gets events from event log (from each computer from iis2003.txt file generated in the previous script)
$comp = gc "iis2003.txt"
$path = "c:\temp\logs"
$Oct16 = get-date 10/16/2014
$Oct15 = get-date 10/15/2014
foreach ($entry in $comp) {
$fullname = $path + "\" + $entry + ".txt"
Get-EventLog -LogName system -ComputerName $entry -after $Oct15 -before $Oct16 | Where-Object {$_.eventID -eq '19'} | format-table -wrap >> $fullname
Get-EventLog -LogName system -ComputerName $entry -after $Oct15 -before $Oct16 | Where-Object {$_.eventID -eq '7036' -AND $_.Message -like "The World Wide Web Publishing Service service entered the stopped state."} | format-table -wrap >> $fullname

}

piątek, 17 października 2014

wtorek, 14 października 2014

Get SCCM site maintenance tasks from powershell (SCCM 2012)

1. Run 32-bit Powershell
2. Import-Module $env:SMS_ADMIN_UI_PATH\..\ConfigurationManager.psd1
3. Set-Location NSP:
note: NSP stands for SCCM Site Code
4. Get-CMSiteMaintenanceTask