Skip to content

Instantly share code, notes, and snippets.


  • 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 / CredentialObjectOneLine.ps1
Created Jun 28, 2018
A one line command to get a full (username and password) credential object without bringing them in from variables.
View CredentialObjectOneLine.ps1
$Credential = New-Object System.Management.Automation.PSCredential 'username',(convertto-securestring 'password' -asplaintext -force)
AshFlaw / Get-AvailableRAM.ps1
Created Jul 17, 2018
Get available RAM on a remote server via powershell
View Get-AvailableRAM.ps1
$Server = ""
(Get-Counter -Counter "\Memory\Available MBytes" -ComputerName $Server).CounterSamples[0].CookedValue
AshFlaw / Set-EolMailBoxAuditEnabledAll.ps1
Created Jul 19, 2018
Enable Exchange Online mailbox auditing manually for all mailboxes
View Set-EolMailBoxAuditEnabledAll.ps1
Get-Mailbox -Filter {AuditEnabled -eq $False} -RecipientTypeDetails UserMailbox, SharedMailbox | Set-Mailbox -AuditEnabled $True –AuditDelegate Create, FolderBind, SendAs, SendOnBehalf, SoftDelete, HardDelete, Update, Move, MoveToDeletedItems, UpdateFolderPermissions
AshFlaw / EOL-MailBoxAuditing.ps1
Created Jul 19, 2018
Check, enable and disable Tenant level mailbox auditing in Exchange Online
View EOL-MailBoxAuditing.ps1
# 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
AshFlaw / CopyADGroupMemberships.ps1
Created Jul 19, 2018
Copy AD group memberships from one user account to another.
View CopyADGroupMemberships.ps1
$Source = ""
$Destination = ""
Get-ADUser -Identity $Source -Properties memberof | Select-Object -ExpandProperty memberof | Add-ADGroupMember -Members $Destination
AshFlaw / install-GPMC.ps1
Created Aug 15, 2018
Install Group Policy Management Console, GPMC via PowerShell
View install-GPMC.ps1
Install-WindowsFeature –Name GPMC
AshFlaw / Add-OMSNetworkMonitoringFirewallRules.ps1
Created Sep 12, 2018
Bulk add the OMS Log Analytics Network Monitoring rules to all machines in a domain
View Add-OMSNetworkMonitoringFirewallRules.ps1
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
AshFlaw / Invoke-DisconnectedRDPSessionLogOff.ps1
Created Sep 30, 2018
Remotely log off all disconnected sessions from a server, RDP session hosts or otherwise.
View Invoke-DisconnectedRDPSessionLogOff.ps1
$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
AshFlaw / Remove-SSLNagScreenPRTG.ps1
Last active Oct 7, 2018
Remove the SSL reminder screen in PRTG. Useful for reverse proxy situations when the proxy is SSL but the internal termination is HTTP.
View Remove-SSLNagScreenPRTG.ps1
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
AshFlaw / Set-WindowsFirewallPortsShazamDiscovery.ps1
Created Nov 16, 2018
Configure windows firewall to allow Shazam probe discovery
View Set-WindowsFirewallPortsShazamDiscovery.ps1
$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}
You can’t perform that action at this time.