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
kill <SPID> | |
USE [master] | |
ALTER DATABASE <DBName> | |
SET MULTI_USER | |
GO |
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
$server = "" | |
$app = Get-WmiObject -Class Win32_Product -computer $server | Where-Object {$_.Name -match "Microsoft Monitoring Agent"} | |
$app.Uninstall() |
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
$Instance = "" | |
Set-DbaDatabaseOwner -SqlServer $Instance | |
Remove-SqlOrphanUser -SqlServer $Instance | |
Set-DbaQueryStoreConfig -SqlServer $Instance ` | |
-State ReadWrite ` | |
-FlushInterval 600 ` | |
-CollectionInterval 10 ` | |
-MaxSize 100 ` | |
-CaptureMode All ` | |
-CleanupMode Auto ` |
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 DATABASE UserIPAudit | |
GO | |
USE UserIPAudit | |
GO | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON |
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
USE UserIPAudit | |
GO | |
CREATE TRIGGER LogonTrigger ON ALL SERVER FOR LOGON | |
AS | |
BEGIN | |
DECLARE @data XML | |
SET @data = EVENTDATA() | |
INSERT INTO UserIPAudit.dbo.[UserIPLog] | |
( |
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
$ErrorActionPreference = "Continue" | |
$computers = Get-ADComputer -Filter 'ObjectClass -eq "Computer"' | Select-Object -Expand DNSHostName | |
Function DisableDefrag | |
{ | |
If ((Get-ScheduledTask -TaskName 'ScheduledDefrag').State -eq 'Ready') | |
{ | |
Disable-ScheduledTask -TaskName 'ScheduledDefrag' -TaskPath '\Microsoft\Windows\Defrag' | |
Write-Output "$env:computername Scheduled defrag disabled" | |
} |
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
/* | |
// You can use this file to modify the appearance of the PRTG web interface | |
// as described in https://kb.paessler.com/en/topic/33 | |
// | |
// Please note that you are using an unsupported and deprecated feature. | |
// Your changes will be broken or removed with future PRTG updates. | |
// | |
// If you modify this file, PLEASE LET US KNOW what you're changing and why! | |
// Just drop an email to support@paessler.com and help us understand your | |
// needs. Thank you! |
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 Install-EXE | |
{ | |
Param | |
( | |
$Command | |
) | |
$processID = (Invoke-WmiMethod -class Win32_process -name Create -ArgumentList $Command -ErrorAction Stop).processid | |
Wait-Process -Id $processID | |
} |
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
$ServiceName = "MsDtsServer130" #SQL 2016 SSIS Service Name | |
$SSIS_Service = Get-WmiObject win32_service | where-object {$_.Name -eq $ServiceName} | |
If ($SSIS_Service -ne $null) | |
{ | |
$SSIS_AppDesc = "Microsoft " + (Get-Service $ServiceName).DisplayName # Add the prefix which is not present in the service description | |
$SSISAccount = $SSIS_Service.StartName.Split("\") | |
$user = $SSISAccount[1] | |
$domain = $SSISAccount[0] | |
$appdesc = $SSIS_AppDesc | |
$app = get-wmiobject -query ('SELECT * FROM Win32_DCOMApplicationSetting WHERE Description = "' + $appdesc + '"') -enableallprivileges |
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
Get-ADPrincipalGroupMembership username | select name |
OlderNewer