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
#Validate user is an Administrator | |
Write-Verbose "Checking Administrator credentials" | |
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { | |
Write-Warning "You are not running this as an Administrator!`nPlease re-run module with an Administrator Account." | |
Break | |
} | |
#Load Functions | |
$ScriptPath = Split-Path $MyInvocation.MyCommand.Path | |
Try { |
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
input { | |
syslog { | |
port => 1514 | |
} | |
} | |
filter { | |
#IP Address of Snort | |
if [host] =~ /192\.168\.0\.250/ { | |
mutate { |
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 Get-MappedDrives { | |
<# | |
.Synopsis | |
Returns the Mapped Drives on the system | |
.DESCRIPTION | |
This function uses WMI to query computers on the network and return the mapped drives, not local drives. | |
If no user is logged on there will likely be an error about RPC server not available. | |
.PARAMETER ComputerName | |
The name of the system(s) you want to check | |
.EXAMPLE |
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 Get-FileName($initialDirectory) { | |
Add-Type -Assembly System.windows.forms | Out-Null | |
$initialDirectory = "C:\" | |
$OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog | |
$OpenFileDialog.InitialDirectory = $initialDirectory | |
$OpenFileDialog.Filter = "Log files (*.Log)| DhcpSrvLog-*.log" | |
$OpenFileDialog.Multiselect = $false | |
$OpenFileDialog.ShowDialog() | Out-Null | |
$OpenFileDialog.FileName | |
} #end function Get-FileName |
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 WSUSUpdate { | |
<# | |
Slight modification of https://gist.github.com/jacobludriks/9ca9ce61de251a5476f1 | |
#> | |
$Criteria = "IsInstalled=0 and Type='Software'" | |
$Searcher = New-Object -ComObject Microsoft.Update.Searcher | |
try { | |
$SearchResult = $Searcher.Search($Criteria).Updates | |
if ($SearchResult.Count -eq 0) { | |
Write-Output "There are no applicable updates." |
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-ADUser –Identity $user –Properties MemberOf).MemberOf -replace '^CN=([^,]+),OU=.+$','$1' > c:\user-groups.txt | |
# The -replace will strip the CN of the group from the Distinguished Name. | |
# This isn't error proof, but will be adequate for most use cases when dealing with Security Groups. |
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 Get-LoggedOnUserSession { | |
#mjolinor 3/17/10 | |
[CmdletBinding()] | |
param | |
( | |
[Parameter(Position=0, | |
ValueFromPipeline=$true, | |
ValueFromPipelineByPropertyName=$true)] | |
[string[]]$Name = $env:COMPUTERNAME) |
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
$strFilter = "(&(objectClass=Person)(objectCategory=User))" | |
$objDomain = New-Object System.DirectoryServices.DirectoryEntry | |
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher | |
$objSearcher.SearchRoot = $objDomain | |
$objSearcher.PageSize = 1000 | |
$objSearcher.Filter = $strFilter | |
$objSearcher.SearchScope = "Subtree" |
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
$Computers = Get-ADComputer -Filter * | Where distinguishedName -NotLike "*DC*" | |
$user = Get-WmiObject Win32_UserAccount -Filter "LocalAccount=true" | where { $_.Name -eq 'Administrator' } | |
$Count = 1 | |
$CharSet1 = [Char[]]"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890" | |
ForEach ($c in $Computers) | |
{ Write-Progress -Id 1 -Activity "Changing Server Passwords" -Status "Current Progress: $Count of $($Servers.Count): $($Server.Name)" -PercentComplete (($Count / $c.Count) * 100) | |
$Ping = Test-Connection $c.Name -Count 2 -Quiet | |
If ($Ping) { | |
$Password = (($CharSet1 | Get-Random -Count 5) -join "") + " " + ` |
OlderNewer