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-Choco | |
{ | |
Set-ExecutionPolicy Bypass -force | |
If (!(Test-Path -Path "C:\ProgramData\chocolatey")) | |
{ | |
$env:chocolateyUseWindowsCompression = 'false' | |
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression | |
choco feature enable -n=allowGlobalConfirmation | |
} | |
} |
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
Set-ExecutionPolicy Unrestricted | |
# Install Chocolatey | |
Invoke-WebRequest https://chocolatey.org/install.ps1 -UseBasicParsing | Invoke-Expression | |
# Enable Global confirmation (auto accept any prompts) | |
choco feature enable -n=allowGlobalConfirmation |
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 Test-SQLTableExists | |
{ | |
param ($Instance,$Database,$TableName) | |
$Return = $SQL = $dataTable = $null | |
$sql = "SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = N'$TableName'" | |
$dataTable = Invoke-Sqlcmd2 -ServerInstance $Instance -Database $Database -Query $sql | |
if ($dataTable) {$return = $true} | |
else {$return = $false} | |
$Return | |
} |
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 |
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
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
/* | |
// 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
$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
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
CREATE DATABASE UserIPAudit | |
GO | |
USE UserIPAudit | |
GO | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON |