# change $Path to a ZIP file that exists on your system! $Path = "$Home\Desktop\Test.zip"
# change extension filter to a file extension that exists # inside your ZIP file $Filter = '*.wav'
# change output path to a folder where you want the extracted # files to appear $OutPath = 'C:\ZIPFiles'
# ensure the output folder exists $exists = Test-Path-Path$OutPath if ($exists-eq$false) { $null = New-Item-Path$OutPath-ItemType Directory -Force }
# load ZIP methods Add-Type-AssemblyName System.IO.Compression.FileSystem
# open ZIP archive for reading $zip = [System.IO.Compression.ZipFile]::OpenRead($Path)
# find all files in ZIP that match the filter (i.e. file extension) $zip.Entries | Where-Object { $_.FullName -like$Filter } | ForEach-Object { # extract the selected items from the ZIP archive # and copy them to the out folder $FileName = $_.Name [System.IO.Compression.ZipFileExtensions]::ExtractToFile($_, "$OutPath\$FileName", $true) }
# adjust this to a remote computer of your choice # (or multiple computers, comma-separated) # PowerShell remoting needs to be enabled on that computer # and you need to have local Admin privileges on that computer $ComputerName = 'pc01'
# execute this code remotely on the machine(s) $code = { # read the given registry value... Get-ItemProperty-Path hklm:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\* | # and show the reg values with the names below Select-Object DisplayName, DisplayVersion, UninstallString }
# "beam" the code over to the target computer(s), and retrieve # the result, then show it in a grid view window Invoke-Command-ScriptBlock$code-ComputerName$ComputerName | Out-GridView
$ComputerName = 'pc01' # NOTE: RemoteRegistry Service needs to run on a target system! $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName) $key = $reg.OpenSubKey('SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall')
$key.GetSubKeyNames() | ForEach-Object { $subkey = $key.OpenSubKey($_) [PSCustomObject]@{ Name = $subkey.GetValue(‘DisplayName’) Version = $subkey.GetValue(‘DisplayVersion’) } $subkey.Close() }
# this is where the PowerShell operational log stores its settings $Path = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\winevt\Channels\Microsoft-Windows-PowerShell/Operational"
# get the default SDDL security definition for the classic security log $sddlSecurity = ((wevtutil gl security) -like'channelAccess*').Split(' ')[-1]
# get the current SDDL security for the PowerShell log $sddlPowerShell = (Get-ItemProperty-Path$Path).ChannelAccess
# store the current SDDL security (just in case you want to restore it later) $existsBackup = Test-Path-Path$Path if (!$existsBackup) { Set-ItemProperty-Path$Path-Name ChannelAccessBackup -Value$sddlPowerShell }
# set the hardened security to the PowerShell operational log Set-ItemProperty-Path$Path-Name ChannelAccess -Value$sddlSecurity
# restart the service to take effect Restart-Service-Name EventLog -Force