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
$duration = (Get-Date).AddDays(-365) | |
Get-ADComputer -Filter {LastLogonDate -lt $duration} | Select-Object Name, LastLogonDate | Sort-Object 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
SET NOCOUNT ON | |
USE master | |
GO | |
/* | |
* Update usage statistics. Not a necessary step | |
* but will provide more accurate results | |
*/ | |
DBCC UPDATEUSAGE(0) | |
IF OBJECT_ID('tempdb..#tmp') 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
Function Set-SQLLogFileSizeAndGrowth | |
{ | |
Param | |
( | |
$Instance | |
) | |
Import-Module dbatools -ErrorAction SilentlyContinue | |
If ((Get-Module | Where-Object {$_.Name -eq "dbatools"}) -eq $null) | |
{ | |
Write-Output "Installing required module: $dbatools" |
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 Invoke-RemoteVolumeExpand | |
{ | |
Param | |
( | |
$Server | |
) | |
Function Invoke-VolumeExpand | |
{ | |
$Include = "C|W|D|E|F" | |
$Partitions = Get-Partition | Where-Object {$_.DriveLetter -Match $Include} |
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
$AccountName = "" | |
Set-AdAccountPassword -Identity $AccountName -OldPassword (Read-Host -asSecureString "Current password") -NewPassword (Read-Host -asSecureString "New password") |
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
logoff /server:remote_computer_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
$Credential = New-Object System.Management.Automation.PSCredential 'username',(convertto-securestring 'password' -asplaintext -force) |
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 = "" | |
(Get-Counter -Counter "\Memory\Available MBytes" -ComputerName $Server).CounterSamples[0].CookedValue |
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-Mailbox -Filter {AuditEnabled -eq $False} -RecipientTypeDetails UserMailbox, SharedMailbox | Set-Mailbox -AuditEnabled $True –AuditDelegate Create, FolderBind, SendAs, SendOnBehalf, SoftDelete, HardDelete, Update, Move, MoveToDeletedItems, UpdateFolderPermissions |