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
## Powershell Version: x.x | |
Write-host -ForegroundColor Green -BackgroundColor Black ("PowerShell Version: " + (Get-Host | Select-Object -ExpandProperty Version)) | |
## System Uptime: xx:xx:xX | |
$UpTime = [Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime) | |
$UpTime = (Get-Date) - $Uptime | |
$UpTime = "{0:D2}" -f [int]$UpTime.Days + ':' + "{0:D2}" -f [int]$UpTime.Hours + ':' + "{0:D2}" -f [int]$UpTime.Minutes + ':' + "{0:D2}" -f [int]$UpTime.Seconds | |
Write-Host -ForegroundColor Green -BackgroundColor Black "System Uptime: $($UpTime)" | |
"`n" |
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 Coffee | |
{ | |
Write-Host @' | |
( ( | |
) ) | |
........ | |
| |] | |
\ / | |
`----' |
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
$ports = @{ | |
'File shares/RPC' = '139' ; | |
'File shares' = '445' ; | |
'RDP' = '3389'; | |
#'Zenworks' = '1761'; | |
} | |
foreach ($service in $ports.Keys) { | |
stuff | |
} |
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
# Scan for open ports | |
$ports = @{ | |
'File shares/RPC' = '139' ; | |
'File shares' = '445' ; | |
'RDP' = '3389'; | |
#'Zenworks' = '1761'; | |
} | |
foreach ($service in $ports.Keys) { | |
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-SystemInfo { | |
<# | |
.SYNOPSIS | |
Get Complete details of local system info | |
.DESCRIPTION | |
This function uses WMI class to query local machine for system info. | |
Output is saved to [array] $data | |
.EXAMPLE | |
Get-SystemInfo |
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
System [PSCustomObject] | |
Hardware [hashtable] | |
BIOSManufacturer | |
BIOSName | |
BIOSVersion | |
RAMPhysical | |
RAMTotal | |
RAMUsed | |
RAMFree | |
CPUManufacturer |
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
<# | |
TODO | |
SUGGESTIONS: | |
------------------------------------------ | |
alternatives to WMI: CIM (maxfrost), async (jrich) | |
FIREWALL: | |
------------------------------------------ |
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
$list = import-csv file.csv | |
Foreach ($person in $list) { | |
Send-MailMessage -To $person."E-Mail Address" -Subject "Password expires in $person."Password expires in" days" ` | |
-From * ` | |
-Body "$person."Display Name", your password is due to expire in $person."Password expires in" days. Please change it or die." | |
} |
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
<# | |
CSV CONTENT | |
Display Name,SAM Account Name,Password Last Set,Password Expiry Date,E-mail Address,Password expires in | |
FakeNam1,FakeUsername1,Blah1,123,[email protected],4 day(s) | |
FakeNam2,FakeUsername2,Blah2,456,[email protected],3 day(s) | |
#> | |
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
#Variables | |
$ComputerList = "$HOME\Desktop\computerlist.txt" | |
$SaveDestination = "$HOME\Desktop" | |
#Setup | |
$ErrorActionPreference = "SilentlyContinue" | |
#Script | |
foreach ($ComputerName in (Get-Content $ComputerList)) | |
{ |
OlderNewer