Skip to content

Instantly share code, notes, and snippets.

@iyre
Created February 18, 2020 22:59
Show Gist options
  • Save iyre/edc0f79369c3b6dfc1cb4def7ecbe11f to your computer and use it in GitHub Desktop.
Save iyre/edc0f79369c3b6dfc1cb4def7ecbe11f to your computer and use it in GitHub Desktop.
Check the registry for shared printers
$ComputerName = Read-Host -Prompt 'Host'
Invoke-Command -ComputerName $ComputerName -ScriptBlock {
Get-ChildItem Registry::\HKEY_Users |
Where-Object { $_.PSChildName -notmatch ".DEFAULT|S-1-5-18|S-1-5-19|S-1-5-20|_Classes" } |
Select-Object -ExpandProperty PSChildName |
ForEach-Object { Get-ChildItem Registry::\HKEY_Users\$_\Printers\Connections -Recurse | Select-Object }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment