Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Friday, January 25, 2019

Windows–DISM PowerShell Replacement

So you need to find the version of windows on your ISO file but you named it windows.iso … well here is how we solved that using DISM
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 4

Get-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

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

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