This file contains hidden or 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
| Invoke-commamd -computername . -scriptblock { klist -lh 0 -li 0x3e7 purge; gpupdate /force } |
This file contains hidden or 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
| 'CredentialGuard' -match ((Get-ComputerInfo).DeviceGuardSecurityServicesConfigured) |
This file contains hidden or 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
| # reference https://docs.microsoft.com/en-us/azure/firewall/firewall-faq#how-can-i-stop-and-start-azure-firewall | |
| $azfw = Get-AzFirewall -Name "fw-myazurefirewall-dev" -ResourceGroupName "rg-myazurefirewall-dev" | |
| $azfw.Deallocate() | |
| Set-AzFirewall -AzureFirewall $azfw |
This file contains hidden or 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
| $user = @' | |
| DOMAIN\svc_FooTester | |
| '@ | |
| $password = @' | |
| aReallyComplexPasswordString_lJ"ztdz&9|Gb;2mHlA^G5RhG2R@o!YMK | |
| '@ | |
| # create a new credential | |
| $serviceAccountCred = [PSCredential]::New($user,(convertto-securestring -asplaintext -force $password)) |
This file contains hidden or 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
| $updates = Get-WmiObject -Namespace Root\ccm\clientSDK -Class CCM_softwareupdate -computername . | |
| $rebootRequiredBoolean = Invoke-WmiMethod -ComputerName . -Namespace "ROOT\ccm\ClientSDK" -Class "CCM_ClientUtilities" -Name DetermineIfRebootPending | Select-Object -Property PSComputerName,RebootPending |
This file contains hidden or 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
| $interfaces = Get-WmiObject Win32_NetworkAdapter | where {$_.Name.equals("vmxnet3 Ethernet Adapter")} | |
| foreach ($interface in $interfaces) | |
| { | |
| $powerMgmt = Get-WmiObject MSPower_DeviceEnable -Namespace root\wmi | where {$_.InstanceName.Contains($interface.PNPDeviceID)} | |
| $powerMgmt.Enable = $False | |
| $powerMgmt.psbase.Put() | |
| } |
This file contains hidden or 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-adobject -searchbase (get-adrootdse).schemanamingcontext -filter * -properties *) | ?{$_.distinguishedname -like "*commonNameFilter*,dc=domain,dc=tld"} | % {$_.canonicalname; $_.attributeid} |
This file contains hidden or 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-azureadgroup -searchstring "Azure PIM" | % {$_.DisplayName; $_ | get-azureadgroupmember | % {$_.DisplayName}} |
This file contains hidden or 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
| # backup | |
| $gpos = "gponame1","gpo2","gpo3" | |
| foreach ($gpo in $gpos) | |
| { | |
| get-gpo -Name $gpo | backup-gpo -Path C:\foo\backup | |
| } | |
| # restore |
This file contains hidden or 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
| editcap.exe -A "2020-08-05 03:58:00" -B "2020-08-05 04:05:00" "c:\path\to\input.pcapng" "c:\path\to\output.pcapng" |