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
# Run this script to see connected hard disk status with nifty bar graph! | |
Begin { | |
function Get-BarGraph($Percent){ | |
# Max width of graph | |
$Width = 20 | |
Write-Host '['-NoNewline | |
# Loop that animates the bar, also scales the percentage so bar does not take up too much space | |
While($tick++ -le $Percent/100*$Width-1){ | |
if ($tick -le $Width / 1.7) { | |
Write-Host "$([char]0x25A0)" -NoNewline -ForegroundColor Green |
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
# Pings all ipaddresses in given subnet ip range | |
# Neatly shows IP address, hostname, manufacturer, and model according to WMI | |
Write-Host 'Enter desired subnet without last octet. Example xxx.xxx.xxx.' | |
$subNet = Read-Host | |
$ipFrom = Read-Host 'Last octet range FROM ' | |
$ipTo = Read-Host 'Last octet range TO ' | |
function testRange ($from, $to){ | |
if($from -gt $to){ | |
Write-Host 'Invalid IP range!'-ForegroundColor Red |
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
<# Notes: | |
Goal - Create a domain controller and populate with OUs, Groups, and Users. | |
This script must be run after prepDomainController. | |
Disclaimer - This example code is provided without copyright and AS IS. It is free for you to use and modify. | |
Credit to Greg Shields | |
#> | |
configuration BuildDomainController |
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
<# Notes: | |
Goal - Prepare the local machine by installing needed PowerShell Gallery modules. | |
Disclaimer - This example code is provided without copyright and AS IS. It is free for you to use and modify. | |
Credit to Greg Shields | |
#> | |
Get-PackageSource -Name PSGallery | Set-PackageSource -Trusted -Force -ForceBootstrap |
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
#show info of THIS computer | |
wmic csproduct | |
#show info of a REMOTE computer, start a PSSession | |
Enter-PsSession [computerName] | |
#show only one of the values from a given column IE "Name" | |
wmic csproduct get name |
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
$DomainName = 'LDAP://OU=Test Computers,DC=Contoso,DC=Com' | |
$Root = New-Object DirectoryServices.DirectoryEntry $DomainName | |
$objSearcher = New-Object DirectoryServices.DirectorySearcher | |
$objSearcher.SearchRoot = $Root | |
$objSearcher.SearchScope = "SubTree" | |
$objSearcher.Filter = "(objectCategory=computer)" | |
$colResults = $objSearcher.FindAll() | |
foreach ($objResult in $colResults) |