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
| <# | |
| .SYNOPSIS | |
| Exports AD user last-logon data (per-DC) to Excel for stale-account analysis. | |
| .DESCRIPTION | |
| Queries all domain controllers for each user’s LastLogon (non-replicated) and LastLogonTimestamp (replicated), then computes | |
| MostRecentLogon + DaysSinceLastLogin and exports results to a timestamped Excel workbook. | |
| .PREREQUISITES | |
| - RSAT ActiveDirectory module available (Get-ADUser / Get-ADDomainController). |
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
| <# | |
| .SYNOPSIS | |
| List GPOs in the current domain that are not linked to any OU, | |
| show a count at the top, and display results sorted by "Date Last Modified" (oldest → newest). | |
| .OUTPUTS | |
| Console count + table: GPO Name, Date Created, Date Last Modified, Status, Linked OUs (None) | |
| .NOTES |
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
| SigninLogs | |
| | where parse_json(tostring(parse_json(NetworkLocationDetails)[0].networkNames))[0] == "Guest WiFi" | |
| | where DeviceDetail.trustType == "Hybrid Azure AD joined" | |
| | extend displayName_ = tostring(DeviceDetail.displayName) | |
| | project UserPrincipalName, displayName_ | |
| | summarize count() by UserPrincipalName, displayName_ | |
| | sort by count_ |
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
| <# | |
| https://community.fortinet.com/t5/FortiGate/Technical-Tip-List-of-TCP-and-UDP-ports-used-by-the-FSSO/ta-p/194130 | |
| UDP/8002 – DC Agent keepalive and push logon info to Collector Agent | |
| TCP/8001 – FortiGate to FSSO Collector Agent connection (SSL) | |
| TCP/8000 – FortiGate to FSSO Collector Agent connection | |
| TCP/8000 – NTLM | |
| #> | |
| $fgtIP = '192.168.0.1' | |
| $DCs = @('192.168.0.51', '192.168.0.52', '192.168.0.61', '192.168.0.62') |
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-content $env:systemroot\system32\LogFiles\Firewall\pfirewall.log | Select-Object -Last 20 |
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
| ### Set Common Parameters ### | |
| $now = Get-Date -UFormat "%Y-%m-%d_%H-%M-%S" | |
| $extNIC = "Ethernet" | |
| $extSM = "255.255.255.0" | |
| $outpath = "c:\temp\" | |
| $outscriptname = "setIP_postwork.ps1" | |
| $outfile = $outpath + $outscriptname | |
| $CheckFilePath = Test-Path $outfile | |
| ## Get the current IPv4 info for external NIC ## | |
| $NetIPextnic = (Get-NetIPAddress -AddressFamily IPv4 -InterfaceAlias $extnic) |
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
| $now = Get-Date -UFormat "%Y-%m-%d_%H-%M-%S" | |
| $filepath = 'C:\temp\Service_Accounts_' + $now + '.csv' | |
| Get-ADUser -Filter * -Searchbase "DC=domain,DC=com" -Properties * | Export-CSV -append -NoTypeInformation $filepath |
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
| $files = Get-ChildItem -file -Path "C:temp\" | |
| ForEach ($file in $files) { | |
| Rename-Item -Path $file.FullName -NewName ([String]$(Get-Random) + $file.Extension) | |
| } |
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
| # Changes | |
| ConfigurationChange | |
| | take 5 | |
| # Data | |
| ConfigurationData | |
| | take 5 | |
| # Changes by Computer | |
| ConfigurationChange |
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
| Remove-Item ` | |
| -Path HKLM:SoftwarePoliciesMicrosoftWindowsWindowsUpdate ` | |
| -Force ` | |
| -Recurse ` | |
| -ErrorAction SilentlyContinue; | |
| Stop-Service -Name wuauserv; | |
| Start-Service -Name wuauserv; | |
| (New-Object -ComObject Microsoft.Update.AutoUpdate).DetectNow() |
NewerOlder