Friday, January 25, 2019
Windows–DISM PowerShell Replacement
dism /Get-WimInfo /WimFile:F:\sources\install.esd /index:1
Now using PowerShell
Get-WindowsImage –imagepath .\install.wim
but what if you don’t have the install.wim … look for install.esd instead
Get-WindowsImage –impagepath .\install.esd
References
https://www.computerworld.com/article/3309257/microsoft-windows/grab-a-free-copy-of-win10-version-1803-and-save-it-for-a-rainy-day.html
https://www.winhelponline.com/blog/iso-find-windows-build-version-edition-using-dism/
https://docs.microsoft.com/en-us/windows-hardware/manufacture/desktop/use-dism-in-windows-powershell-s14
Tuesday, November 28, 2017
Windows 10 PowerShell Reference Guide
Course 20697-1 Implementing and Managing Windows 10
Module 3
Get-ExecutionPolicy
Set-ExecutionPolicy Unrestricted
Get-PrinterProperty –PrinterName “HP Photosmart 7520”
Note: The property named Config:DuplexUnit is set to TRUE.
Set-PrinterProperty –PrinterName “HP Photosmart 7520” –PropertyName “Config:DuplexUnit” –Value FALSE
Note: You must use all caps for the TRUE or FALSE values.
Get-PrinterProperty –PrinterName “HP Photosmart 7520”
Note: The property named Config:DuplexUnit is now FALSE.
# *** Answer *** List Running Services in Green
$services = get-service
foreach ($service in $services) {
if ($service.status –eq “Running”) {
$color = “Green” }
Else {
$color = “Red” }
write-host $service.Name “ – “ $service.Status –ForegroundColor $color
}
write-host “A total of “ $services.count “services were evaluated”
write-host “Script execution is complete” –ForegroundColor gray –BackgroundColor Black
Additional Notes Try …
$services | Group-Object -Property status
Module 4Get-NetIPAddress
test-connection LON-DC1
Get-DnsClientCache
Clear-DnsClientCache
test-connection www
Get-DnsClientCache | fl
Resolve-Dnsname LON-DC1 | fl
Module 5
$MaxSize = (Get-PartitionSupportedSize –DriveLetter e).sizeMax
Resize-Partition –DriveLetter e –Size $MaxSize
Clear-Disk –Number 1 –RemoveData
Note: Delete all partitions from disk
Get-Disk | Where partitionstyle -eq 'raw' | Initialize-Disk -PartitionStyle MBR
Module 6
Install-WindowsFeature FS-SyncShareService
Note: After the feature installs, you will receive a warning message because Windows automatic updating is not enabled. You can ignore the warning.
Module 7
add-appxpackage \\lon-dc1\apps\app1.appx
Module 8
Sorry but no noteworthy PowerShell
Module 9
Invoke-Gpupdate –force
Module 10
Run Get-NetIPsecMainModeSA
Note: To examine the Main Mode Security Associations (SAs), at the Windows PowerShell prompt, type the following cmdlet, and then press Enter:
Get-NetIPsecMainModeSA
Run Get-NetIPsecQuickModeSA
Note: To examine the Quick Mode SAs, at the Windows PowerShell prompt, type the following cmdlet, and then press Enter:
Get-NetIPsecQuickModeSA
Module 11
Sorry but no noteworthy PowerShell
Module 12
Sorry but no noteworthy PowerShell
Tuesday, August 29, 2017
Daily PowerShell
Get Installed Apps – thx Jeffrey Hicks – 5.0 5.1
get-package –providername msi,programs | sort name | select name,version
Whatif – thx Ed Wilson
get-process notepad | Stop-Process -WhatIf
https://blogs.technet.microsoft.com/heyscriptingguy/2011/11/21/make-a-simple-change-to-powershell-to-prevent-accidents/
File Rename
http://tweaks.com/windows/49459/batch-file-rename-with-windows-powershell/
Keyword Rename
http://blogs.technet.com/b/heyscriptingguy/archive/2013/11/22/use-powershell-to-rename-files-in-bulk.aspx
Automate DHCP
https://deploymentresearch.com/Research/Post/649/Automate-DHCP-Server-Configuration-via-PowerShell
Redirection
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_redirection?view=powershell-6
Wednesday, June 7, 2017
Windows 10 Troubleshooting PowerShell Reference Guide
Course 10982 – Windows 10 Troubleshooting
Windows PowerShell Remoting
Invoke-Command –ComputerName LON-CL1 –ScriptBlock {Get-EventLog –log system}
$s = New-PSWorkflowSession –ComputerName LON-CL1
Enter-PSSession $s
Get-Command
Invoke-Command -Session $s -ScriptBlock {$c = Get-command}
Invoke-Command -Session $s -ScriptBlock {$c.count}
Invoke-Command -ComputerName LON-CL1, LON-CL3 -ScriptBlock {Get-Culture}
$s = New-PSWorkflowSession -ComputerName LON-CL1, LON-CL3
Invoke-Command -Session $s -ScriptBlock {$c = Get-command}
Invoke-Command -Session $s -ScriptBlock {$c.count}
ISE Remoting
Get-Service | Where-Object {$_.Status -eq “Running”}
Get-NetIPConfiguration
Restart-Computer -Force
Wednesday, December 14, 2016
Windows PowerShell
The power of PowerShell: Essential tips Windows admins will love
http://www.infoworld.com/article/3000612/windows-server/power-of-powershell-essential-tips-every-windows-admin-will-love.html#tk.ifw-infsbCheck out carbon for a new amazing module for DevOps!
http://get-carbon.org/
Check out powersploit for security commands that really rock!
http://www.powershellmagazine.com/2014/07/08/powersploit/
Powershell Mirror Drives
https://gallery.technet.microsoft.com/scriptcenter/3764b3db-6be9-49a8-ba49-75f231ef1954
Friday, December 13, 2013
Great PowerShell Site List
Monthly Power Tips
http://powershell.com/cs/media/g/powertipsmonthly2013/default.aspx
List of cmdlets
http://technet.microsoft.com/en-us/library/ee829690.aspx
Good list of real-world PowerShell scripts (windows)
http://www.youdidwhatwithtsql.com/
From Microsoft
www.codeplex.com
Friday, January 4, 2013
Network Locations using PowerShell
So you can’t manage your network locations from PowerShell by default. Here is a great dll you can add to expose network locations.
Download and extract the dll into your scripts directory from http://archive.msdn.microsoft.com/NLM Look in \NLMCSharp.zip\NLMCSharp\obj\Debug
Add-Type –Path .\Interop.NETWORKLIST.dll
$nlm = new-object NETWORKLIST.NetworkListManagerClass
$nlm.GetNetworks("NLM_ENUM_NETWORK_ALL") | select @{n="Name";e={$_.GetName()}},@{n="Category";e={$_.GetCategory()}},IsConnected,IsConnectedToInternet
Reference from a great article from those scripting guys below
http://blogs.technet.com/b/heyscriptingguy/archive/2012/06/10/weekend-scripter-use-powershell-to-manage-windows-network-locations.aspx
