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 |
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 Auditing Status | |
Get-OrganizationConfig | Select AuditDisabled | |
# Disable Auditing for Tenant | |
Set-OrganizationConfig -AuditDisabled $True | |
# Disable Auditing for User | |
Set-MailboxAuditBypassAssociation -Identity $User -AuditBypassEnabled $True | |
# Find Mailboxes with Audting 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
$Source = "" | |
$Destination = "" | |
Get-ADUser -Identity $Source -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members $Destination |
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
Install-WindowsFeature –Name GPMC |
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 OMSICMPFWRules | |
{ | |
netsh advfirewall firewall add rule name="NPMDICMPV4Echo" protocol="icmpv4:8,any" dir=in action=allow | |
netsh advfirewall firewall add rule name="NPMDICMPV6Echo" protocol="icmpv6:128,any" dir=in action=allow | |
netsh advfirewall firewall add rule name="NPMDICMPV4DestinationUnreachable" protocol="icmpv4:3,any" dir=in action=allow | |
netsh advfirewall firewall add rule name="NPMDICMPV6DestinationUnreachable" protocol="icmpv6:1,any" dir=in action=allow | |
netsh advfirewall firewall add rule name="NPMDICMPV4TimeExceeded" protocol="icmpv4:11,any" dir=in action=allow | |
netsh advfirewall firewall add rule name="NPMDICMPV6TimeExceeded" protocol="icmpv6:3,any" dir=in action=allow | |
} |
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 = '' | |
$sessions = quser /server:$server | where-object { $_ -match "Disc" } | |
Foreach ($Session in $Sessions) | |
{ | |
$UserName = $Session.split(' +')[1] | |
$ID = qwinsta /server:$server $UserName | where-object { $_ -match $UserName } | Where { $_ -ne "" } | ForEach { $_.Replace(" ","") } | ForEach { $_.Replace("Disc","") } | ForEach { $_.ToLower() } | ForEach { $_.Replace("$UserName","") } | |
Write-Output "SessionID $ID Username: $UserName is disconnected" | |
logoff $ID /server:$server | |
} |
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
Write-Output "Stopping PRTG Core Service" | |
Get-Service -Name prtgcoreservice | Stop-Service | |
Write-Output "Disabling SSL nag message in UI" | |
Set-ItemProperty -path "HKLM:\SOFTWARE\Wow6432Node\Paessler\PRTG Network Monitor\Server\Webserver" -Name "showsslnagscreen" -value 0 | |
Write-Output "Starting PRTG Core Service" | |
Get-Service -Name prtgcoreservice | Start-Service |
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
$Servers = Get-ADComputer -Filter 'ObjectClass -eq "Computer"' | Select-Object -Expand DNSHostName | |
Foreach ($Server in $Servers) | |
{ | |
invoke-command -ComputerName $Server -ScriptBlock {Set-NetFirewallRule -DisplayGroup 'Remote Event Log Management' -Enabled True -PassThru -EdgeTraversalPolicy Allow | Select-Object DisplayName, Enabled} | |
invoke-command -ComputerName $Server -ScriptBlock {Set-NetFirewallRule -DisplayGroup "Windows Management Instrumentation (WMI)" -Enabled True -PassThru -EdgeTraversalPolicy Allow -ErrorAction SilentlyContinue | Select-Object DisplayName, Enabled} | |
} |