This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This outlines how to set the "is_ms_shipped" flag to one for custom stored procedures in SQL Server. | |
Note: The following has to be executed as a sysadmin | |
-- Create stored procedure | |
CREATE PROCEDURE sp_example | |
AS | |
BEGIN | |
SELECT @@VERSION | |
END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# hacky ps script to convert ip,openport to ip,allopenports | |
# Container for final list | |
$FullList = New-Object System.Data.DataTable | |
$FullList.Columns.Add("Dest") | Out-Null | |
$FullList.Columns.Add("Port") | Out-Null | |
# import full list of open ports – one per line (dest,port) | |
$ImportList = import-csv C:\temp\open-ports-by-line.csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select n [id], USER_NAME(n) [user_name] | |
from ( | |
select top 10000 row_number() over(order by t1.number) as N | |
from master..spt_values t1 | |
cross join master..spt_values t2 | |
) a | |
where USER_NAME(n) is not null | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$schedule = new-object -com("Schedule.Service") | |
$schedule.connect() | |
$tasks = $schedule.getfolder("\").gettasks(0) | |
$entries = New-Object System.Collections.Generic.List[System.Management.Automation.PSObject] | |
$tasks | | |
ForEach-Object { | |
# Get task information |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is a TSQL template for executing OS commands through SQL Server using OLE Automation Procedures. | |
-- Enable Show Advanced Options | |
sp_configure 'Show Advanced Options',1 | |
RECONFIGURE | |
GO | |
-- Enable OLE Automation Procedures | |
sp_configure 'Ole Automation Procedures',1 | |
RECONFIGURE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Find-DbaSqlInstance | |
{ | |
<# | |
.SYNOPSIS | |
This function can be used to enumerate SQL Server instances using common methods. | |
.EXAMPLE | |
Check if the provided computer(s) or instance(s) respond to ping. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# todo | |
<# | |
- Note: dependant on PowerUpSQL. | |
1 - have script accept command or source script as string | |
--- have that get bake into the wmi provider method | |
--- update the wmi method to execute the provided string as a script block | |
--- mod the clr to return the output of the wmi command | |
- roll into clone of the invoke-sqloscmdclr function so it can scale | |
- remove wmi cs and dll on client | |
- remove sql dll cs and dll on client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Script: Find-DbaSqlInstance | |
# version 0.14.5 | |
# Author: Scott Sutherland, 2018 NetSPI | |
# Contributions from: Warren F. (Invoke-Parallel), https://gallery.technet.microsoft.com/scriptcenter/List-the-IP-addresses-in-a-60c5bb6b | |
# ------------------------ | |
# Current feature summary | |
# ------------------------ | |
# 1 - Import list of IP addresses, computer names, or SQL instances from a file via "-SqlInstanceFile" param - works |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -------------------------------------------- | |
# Create Form | |
# -------------------------------------------- | |
# Create primary form | |
Add-Type -AssemblyName System.Windows.Forms | |
$Form = New-Object system.Windows.Forms.Form | |
$Form.Text = "" | |
#$Form.Opacity = 0.98 # 1.0 is fully opaque; 0.0 is invisible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Text; | |
using System.Security.Principal; | |
using System.Runtime.InteropServices; | |
using Microsoft.Win32; | |
namespace lsautil | |
{ | |
// https://msdn.microsoft.com/en-us/library/microsoft.win32.registry(v=vs.110).aspx |
OlderNewer