- https://www.powershellgallery.com/
- "The central repository for sharing and acquiring PowerShell code including PowerShell modules, scripts, and DSC resources."
- https://docs.microsoft.com/en-us/powershell/gallery/overview
- https://docs.microsoft.com/en-us/powershell/gallery/getting-started
-
Windows Server 2019 & PowerShell All-in-One For Dummies, 1st Edition
-
Learn PowerShell Toolmaking in a Month of Lunches, 1st Edition
-
Windows PowerShell Pocket Reference: Portable Help for PowerShell Scripters, Second Edition
-
Windows PowerShell in 24 Hours, Sams Teach Yourself, 1st Edtion
-
Learn PowerShell Core 6.0: Automate and control administrative tasks using DevOps principle
-
Pro PowerShell for Amazon Web Services: DevOps for the AWS Cloud
-
2020 Books to look for...
-
What Version am I running?
$PSVersionTable.PSVersion
-
Add a firewall rule
netsh advfirewall firewall add rule name="docker engine" dir=in action=allow protocol=TCP localport=2375
-
Generate a GID
[guid]::newguid()
-
Get Hash
- https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/get-filehash?view=powershell-7.3
Get-FileHash
- Algorithms supported: SHA1, SHA256, SHA384, SHA512, MD5
-
Get Serial Numbers:
wmic memorychip get serialnumber
wmic diskdrive get serialnumber
wmic baseboard get serialnumber
wmic cdrom where drive='d:' get SerialNumber
-
Disable WiFi
netsh interface set interface name="Wireless Network Connection" admin=DISABLED
-
Hybernation
powercfg /hibernate on
powercfg /hibernate off
- https://groupby.org/conference-session-abstracts/powershell-for-the-sql-dba/
Enable-PSRemoting
Set ExecutionPolicy RemoteSignted -force
- (...many other examples in the video...)
-
PowerShell script files end in ".ps1"
-
To pass parameters into a sccript:
- Define parameters on first line, such as:
Param([string]$clsid)
-
To execute a file, use the command line form of
.\{sciprt.ps1}
-
Get BIOS info
Get-WmiObject win32_bios
Get-WmiObject -Class Win32_BIOS | Format-List *
- https://sumtips.com/snippets/powershell/get-bios-information-with-powershell-cmd/
-
"Start Using Constrained Language Mode"
- https://blog.danskingdom.com/allow-others-to-run-your-powershell-scripts-from-a-batch-file-they-will-love-you-for-it/
- https://stackoverflow.com/questions/19335004/how-to-run-a-powershell-script-from-a-batch-file
Powershell.exe -executionpolicy remotesigned -File ps.ps1
-
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\Users\SE\Desktop\ps.ps1""' -Verb RunAs}"
- If you need to run as Admin
powershell.exe -ExecutionPolicy Bypass -Command "Path\xxx.ps1"
- If you launch PowerShell as administrator...