MS SQL Server Database Logging

In order to enable MSSQL Server database logging into the MSSQL Log 1). Open an elevated Poershell prompt 2). Run the query Invoke-Sqlcmd -Query "EXEC xp_instance_regwrite N’HKEY_LOCAL_MACHINE’, N’Software\Microsoft\MSSQLServer\MSSQLServer’, N’AuditLevel’, REG_DWORD, …

wget with Powershell v2

PS:> (new-object System.Net.WebClient).DownloadString("https://www.google.com") >> output.txt The URL should have http or https or web client will look for a file on disk. Powershell 3 and higher has other ways of …

Get System Downtime

Determine your Powershell exectuion policy Get-ExecutionPolicy Change your Powershell exectuion policy if restricted Set-ExecutionPolicy RemoteSigned Script to get system downtime [timespan]$downTime = New-TimeSpan -start 0 -end 0 [timespan]$totalDownTime = New-TimeSpan …