This file contains hidden or 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
Get-Process | Sort-Object -Unique -Property 'Name' | Select-Object -Property @( | |
@{ | |
'Label' = 'Name' | |
'Expression' = { | |
$psItem.Name | |
} | |
} | |
@{ |
This file contains hidden or 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
$String = 'Narrator.exe' | |
$MemoryStream = [System.IO.MemoryStream]::new() | |
$StreamWriter = [System.IO.StreamWriter]::new( $MemoryStream ) | |
$StreamWriter.write( $String ) | |
$StreamWriter.Flush() | |
$MemoryStream.Position = 0 | |
$Hash = Get-FileHash -InputStream $MemoryStream -Algorithm 'SHA1' | |
$HexString = '0x' + | |
$Hash.Hash.Substring( 6, 2 ) + |
This file contains hidden or 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
Set-StrictMode -Version 'Latest' | |
# Collection of attributes to extract | |
$attributeName = [System.Collections.Generic.List[System.String]]::new() | |
$attributeName.Add( 'DeviceFamily' ) | |
$attributeName.Add( 'OSVersionFull' ) | |
$attributeName.Add( 'FlightRing' ) | |
$attributeName.Add( 'App' ) | |
$attributeName.Add( 'AppVer' ) |
This file contains hidden or 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
<# | |
AnalyticsInfo class is the documented way to track OS version. It returns | |
a string value. The format of this string is not documented, and one should | |
not rely on a certain value. Those values can only be used to tell one OS | |
version from another. | |
https://docs.microsoft.com/uwp/api | |
/windows.system.profile.analyticsversioninfo.devicefamilyversion | |
This API is not available on Server Core |
This file contains hidden or 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 | |
ConvertFrom-RawXml | |
{ | |
[System.Management.Automation.CmdletBindingAttribute()] | |
Param( | |
[System.Management.Automation.ParameterAttribute( | |
Mandatory = $True | |
)] | |
[System.String[]] | |
$String |
This file contains hidden or 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-WindowsPackageEx | |
{ | |
[System.Management.Automation.CmdletBindingAttribute()] | |
Param( | |
[System.Management.Automation.ParameterAttribute( | |
Mandatory = $True, | |
ParameterSetName = 'Online' | |
)] |
This file contains hidden or 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
$ImagePath = '<insert path to your image.iso>' | |
$DiskImage = Get-DiskImage -ImagePath $ImagePath | |
$Access = [Microsoft.PowerShell.Cmdletization.GeneratedTypes.DiskImage.Access]::ReadOnly | |
$DiskImage = Mount-DiskImage -InputObject $DiskImage -Access $Access -PassThru | |
$Volume = Get-Volume -DiskImage $DiskImage | |
$Path = $Volume.DriveLetter + ':' | |
$Source = Join-Path -Path $Path -ChildPath 'Sources\SxS' | |
Add-WindowsCapability -Online -Name 'NetFX3~~~~' -Source $Source | |
$DiskImage = Dismount-DiskImage -InputObject $DiskImage |
This file contains hidden or 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
$Session = New-Object -ComObject 'Microsoft.Update.Session' | |
$Searcher = $Session.CreateUpdateSearcher() | |
$Query = 'IsInstalled = 0 or | |
IsInstalled = 0 and DeploymentAction = ''OptionalInstallation''' | |
$Search = $Searcher.Search( $Query ) | |
If | |
( | |
$Search.Updates.Count |
This file contains hidden or 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.Management.Automation.ScriptBlock]$ScriptBlock = { | |
[cmdletBinding()] | |
Param( | |
[Parameter( | |
Mandatory = $False | |
)] | |
[ValidateNotNullOrEmpty()] |