Skip to content

Instantly share code, notes, and snippets.

AshFlaw

  • The Full Circle
Block or report user

Report or block AshFlaw

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@AshFlaw
AshFlaw / styles_custom_v2.css
Last active Jan 18, 2018
PRTG login and application page customization to remove news feed, footer, logo, lower message text, lost password and download client links.
View styles_custom_v2.css
/*
// 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!
@AshFlaw
AshFlaw / Disable-ScheduledDefrag.ps1
Created Oct 23, 2017
Disable Windows scheduled defrag on all computers in a domain
View Disable-ScheduledDefrag.ps1
$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"
}
@AshFlaw
AshFlaw / Create-SQLUserAndIPLoggingTrigger.sql
Created Oct 16, 2017
Create the trigger to log connection details to the User IP Audit table.
View Create-SQLUserAndIPLoggingTrigger.sql
USE UserIPAudit
GO
CREATE TRIGGER LogonTrigger ON ALL SERVER FOR LOGON
AS
BEGIN
DECLARE @data XML
SET @data = EVENTDATA()
INSERT INTO UserIPAudit.dbo.[UserIPLog]
(
@AshFlaw
AshFlaw / Create-SQLUserAndIPLoggingTable.sql
Created Oct 16, 2017
Create SQL table for logging user connections with permissions and compression on the logging table.
View Create-SQLUserAndIPLoggingTable.sql
CREATE DATABASE UserIPAudit
GO
USE UserIPAudit
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
@AshFlaw
AshFlaw / Set-SQLCleanupDBO_Users_QS.ps1
Created Sep 20, 2017
Quick cleanup of a SQL 2016 instance for DB Owners, Orphaned users and enabling Query Store
View Set-SQLCleanupDBO_Users_QS.ps1
$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 `
@AshFlaw
AshFlaw / Uninstall-OMSAgent.ps1
Created Sep 20, 2017
Uninstall the OMS Microsoft Monitoring Agent.
View Uninstall-OMSAgent.ps1
$server = ""
$app = Get-WmiObject -Class Win32_Product -computer $server | Where-Object {$_.Name -match "Microsoft Monitoring Agent"}
$app.Uninstall()
@AshFlaw
AshFlaw / Set-SQLDBMultiUser.sql
Created Sep 20, 2017
Set a given DB back to multi user mode when locked by a given SPID
View Set-SQLDBMultiUser.sql
kill <SPID>
USE [master]
ALTER DATABASE <DBName>
SET MULTI_USER
GO
You can’t perform that action at this time.