Getting all SQL Server services running on a server using PowerShell: Get-WmiObject -Class sqlservice -Namespace…
Tag: powershell
PowerShell – Making Arrays
The basics of creating a PowerShell array and working with it.
PowerShell – Find Active Node On Cluster
PowerShell script that prints out the state of the node you are on – Active or Passive.
PowerShell – Query Database Remotely
The basic syntax for sending a query to SQL Server using PowerShell. sqlcmd -S SERVER_NAME…
PowerShell – Get Boot Time of Computer
Show Date/Time Of Last Boot Get-WmiObject -class Win32_OperatingSystem | Select-Object __SERVER,@{label='LastBootUpTime';expression={$_.ConvertToDateTime($_.LastBootUpTime)}}
PowerShell – Scripts Not Allowed To Run
If PowerShell is not allowing you to run scripts then you might need to set…
PowerShell – Fast Ping
Source: https://gist.github.com/mbrownnycnyc/9913361 This is a very fast way to ping a server using PowerShell. #…
PowerShell – Get SQL Server Info
$assemblylist = “Microsoft.SqlServer.Management.Common”, “Microsoft.SqlServer.Smo”, “Microsoft.SqlServer.Dmf “, “Microsoft.SqlServer.Instapi “, “Microsoft.SqlServer.SqlWmiManagement “, “Microsoft.SqlServer.ConnectionInfo “, “Microsoft.SqlServer.SmoExtended “, “Microsoft.SqlServer.SqlTDiagM…
PowerShell – Replace All Instances Of Something In All Files In Directory
This script searches every file in a directory for a particular string and replaces it…