Source : http://technet.microsoft.com/en-us/library/testing-for-active-directory-schema-extension-conflicts%28WS.10%29.aspx You can use ADSchemaExtensionConflictAnalyzer.ps1 (http://go.microsoft.com/fwlink/?LinkId=191133), a Windows PowerShell script, to analyze application schema extension .ldf files against a production schema and generate a report on errors, conflicts, and other warnings. For example, if an application schema extension is
Set possible owners on core cluster resources
This script will set possible owners on core cluster resources (IP Address and Name) Script : Get-Cluster -Name ClusterName | Get-ClusterResource -Name “IP Address”,”Name” | Set-ClusterOwnerNode -Owners ClusterNode01,ClusterNode02 References Get-Cluster Get information about one or more failover clusters in a
Set a cluster resource dependency
This script set a cluster resource dependency on a file server clustered resource Script : Get-Cluster -Name ClusterName |` Get-ClusterResource -Name “FileServer-(FileserverResourceHostname)(Cluster Disk 10)” |` Set-ClusterResourceDependency -Dependency [“FileserverResourceHostname”][and [“Cluster Disk 10”]] Reference (http://technet.microsoft.com/en-us/library/ee461029.aspx) Set-ClusterResourceDependency Specify the resources that a particular
Robocopy process management
Restart a service on remote servers
This script restart the service name “SMS Agent Host” on the servers listed in the file C:\temp\BOOK1.txt Script : ForEach($MachineName In $hosts){ $service = Get-Service -ComputerName $MachineName -name “sms agent host” Write-Host $MachineName, $service.status, $service.name (new-Object System.ServiceProcess.ServiceController(‘sms agent host’,$MachineName)).Stop() (new-Object
Rehost an Active Directory partition on one or more Global Catalog servers
Query tool GUI (Active Directory and SQL)
Query a SQL database
This script can be used to query an SQL database Script : $SqlConnection = New-Object System.Data.SqlClient.SqlConnection $SqlConnection.ConnectionString = “Server=DBServerHostname;Database=master;Integrated Security=True” $SqlConnection.Open() $SqlCmd = New-Object System.Data.SqlClient.SqlCommand $SqlCmd.CommandText = “select * from DatabaseName” $SqlCmd.Connection = $SqlConnection $reader = $SqlCmd.ExecuteReader() $Counter = $Reader.FieldCount
Query a DNS zone
Query and retrieve all A records of a specific DNS zone Script : $dns_entries = Get-WmiObject -namespace “root\MicrosoftDNS” -class MicrosoftDNS_Atype -ComputerName dnsServerName -Filter “DomainName = ‘domain.local.net'” foreach ($dnsrecord in $dns_entries) { $dnsrecord.IPAddress + “`t” + $dnsrecord.OwnerName.split(“.”)[0] + “`t” + $dnsrecord.OwnerName
Ping computers in a host file
Just fill the host file with host names you want to ping. Script : $PingMachines = Gc “C:\folder\hosts.txt” ForEach($MachineName In $PingMachines){ $PingStatus = Gwmi Win32_PingStatus -Filter “Address = ‘$MachineName'” | Select-Object StatusCode If ($PingStatus.StatusCode -eq 0){ Write-Host $MachineName ” :