PowerShell – Scripts Not Allowed To Run
If PowerShell is not allowing you to run scripts then you might need to set the execution policy. Set-ExecutionPolicy RemoteSigned https://technet.microsoft.com/en-us/library/ee176961.aspx
If PowerShell is not allowing you to run scripts then you might need to set the execution policy. Set-ExecutionPolicy RemoteSigned https://technet.microsoft.com/en-us/library/ee176961.aspx
cls import-module failoverclusters Import-Module -Name SQLPS -DisableNameChecking $servers = “comma”,”separated”,”server”,”list” foreach($server in $servers) { try { $virtual_name = $server; $instances = ”; try{ $virtual_name = ((get-clusterresource -Cluster $server -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | get-clusterparameter VirtualServerName -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | Select Value -ErrorAction SilentlyContinue -WarningAction SilentlyContinue)[0].Value ) } catch{} $server = $virtual_name; $path = “SQLServer:\SQL\”… Read More »
Source: https://gist.github.com/mbrownnycnyc/9913361 This is a very fast way to ping a server using PowerShell. # with reference to http://theadminguy.com/2009/04/30/portscan-with-powershell/ 2 function fastping{ 3 [CmdletBinding()] 4 param( 5 [String]$computername = “127.0.0.1”, 6 [int]$delay = 100 7 ) 8 9 $ping = new-object System.Net.NetworkInformation.Ping 10 # see http://msdn.microsoft.com/en-us/library/system.net.networkinformation.ipstatus%28v=vs.110%29.aspx 11 try { 12 if ($ping.send($computername,$delay).status -ne “Success”) {… Read More »
$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 “, “Microsoft.SqlServer.SString “, “Microsoft.SqlServer.Management.RegisteredServers “, “Microsoft.SqlServer.Management.Sdk.Sfc “, “Microsoft.SqlServer.SqlEnum “, “Microsoft.SqlServer.RegSvrEnum “, “Microsoft.SqlServer.WmiEnum “, “Microsoft.SqlServer.ServiceBrokerEnum “, “Microsoft.SqlServer.ConnectionInfoExtended “, “Microsoft.SqlServer.Management.Collector “, “Microsoft.SqlServer.Management.CollectorEnum”, “Microsoft.SqlServer.Management.Dac”, “Microsoft.SqlServer.Management.DacEnum”, “Microsoft.SqlServer.Management.Utility” foreach ($asm in $assemblylist) { $asm = [Reflection.Assembly]::LoadWithPartialName($asm) } $computers = Get-Content -Path C:\scripts\servers.txt #… Read More »
This script searches every file in a directory for a particular string and replaces it with another value. get-childItem | ForEach { (Get-Content $_ | ForEach {$_ -replace “OLDVALUE,”NEWVALUE”}) | Set-Content $_}
A script that generates a script to fix all orphaned users at once.
How to get your database out of the “restoring” state so you can use it again.
The Donald Trump campaign has taken the world by storm. Not only has he upset the apple cart in the United States, but he has managed to piss off people in the U.S. and political leaders abroad. Could anyone in the U.S. imagine watching a foreign nation’s election process and lashing out at one of… Read More »
Essentially, Rubio is saying that Trump is a two-term president. Listen to his own words:
This short block of PHP code takes a SQL script and removes the “dash-dash” and “/**/” comments from it. Of course, many languages, including PHP itself, use the “/**/” comment style so this could apply to PHP scripts, as well. The line that removes the dash-dash style comments could easily be changed to the “//”… Read More »