Skip to content

Instantly share code, notes, and snippets.

@mattmcnabb
Created December 14, 2018 18:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mattmcnabb/ab3f1d0f7f778cee570b41463959363f to your computer and use it in GitHub Desktop.
Save mattmcnabb/ab3f1d0f7f778cee570b41463959363f to your computer and use it in GitHub Desktop.
Launch windows control panel applets from PowerShell
$ControlPanelApplets = [ordered]@{
"Add a Device wizard" = "$env:windir\System32\DevicePairingWizard.exe"
"Add Hardware wizard" = "$env:windir\System32\hdwwiz.exe"
"Add a Printer wizard" = "rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL AddPrinter"
"Administrative Tools" = "control.exe /name Microsoft.AdministrativeTools"
"AutoPlay" = "control.exe /name Microsoft.AutoPlay"
"Backup and Restore" = "control.exe /name Microsoft.BackupAndRestoreCenter"
"BitLocker Drive Encryption" = "control.exe /name Microsoft.BitLockerDriveEncryption"
"Color and Appearance" = "explorer shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} -Microsoft.Personalization\pageColorization"
"Color Management" = "control.exe /name Microsoft.ColorManagement"
"Credential Manager" = "control.exe /name Microsoft.CredentialManager"
"Date and Time" = "control.exe /name Microsoft.DateAndTime"
"Default Programs" = "control.exe /name Microsoft.DefaultPrograms"
"Desktop Background" = "explorer shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921} -Microsoft.Personalization\pageWallpaper"
"Desktop Icon Settings" = "rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,0"
"Device Manager" = "control.exe /name Microsoft.DeviceManager"
"Devices and Printers" = "control.exe /name Microsoft.DevicesAndPrinters"
"Ease of Access Center" = "control.exe /name Microsoft.EaseOfAccessCenter"
"File Explorer Options" = "control.exe /name Microsoft.FolderOptions"
"File History" = "control.exe /name Microsoft.FileHistory"
"Fonts" = "control.exe /name Microsoft.Fonts"
"Game Controllers" = "control.exe /name Microsoft.GameControllers"
"Get Programs" = "control.exe /name Microsoft.GetPrograms"
"HomeGroup" = "control.exe /name Microsoft.HomeGroup"
"Indexing Options" = "control.exe /name Microsoft.IndexingOptions"
"Infrared" = "control.exe /name Microsoft.Infrared"
"Internet Properties" = "control.exe /name Microsoft.InternetOptions"
"iSCSI Initiator" = "control.exe /name Microsoft.iSCSIInitiator"
"Keyboard" = "control.exe /name Microsoft.Keyboard"
"Language" = "control.exe /name Microsoft.Language"
"Mouse Properties" = "control.exe /name Microsoft.Mouse"
"Network and Sharing Center" = "control.exe /name Microsoft.NetworkAndSharingCenter"
"Network Connections" = "control.exe ncpa.cpl"
"Network Setup Wizard" = "control.exe netsetup.cpl"
"Notification Area Icons" = "explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}"
"ODBC Data Source Administrator" = "control.exe odbccp32.cpl"
"Offline Files" = "control.exe /name Microsoft.OfflineFiles"
"Performance Options" = "$env:windir\system32\SystemPropertiesPerformance.exe"
"Personalization" = "explorer shell:::{ED834ED6-4B5A-4bfe-8F11-A626DCB6A921}"
"Phone and Modem" = "control.exe /name Microsoft.PhoneAndModem"
"Power Options" = "control.exe /name Microsoft.PowerOptions"
"Presentation Settings" = "$env:windir\system32\PresentationSettings.exe"
"Programs and Features" = "control.exe /name Microsoft.ProgramsAndFeatures"
"Recovery" = "control.exe /name Microsoft.Recovery"
"Region" = "control.exe /name Microsoft.RegionAndLanguage"
"RemoteApp and Desktop Connections" = "control.exe /name Microsoft.RemoteAppAndDesktopConnections"
"Scanners and Cameras" = "control.exe /name Microsoft.ScannersAndCameras"
"Screen Saver Settings" = "rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1"
"Security and Maintenance" = "control.exe /name Microsoft.ActionCenter"
"Set Associations" = "control.exe /name Microsoft.DefaultPrograms /page pageFileAssoc"
"Set Default Programs" = "control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram"
"Set Program Access and Computer Defaults" = "rundll32.exe shell32.dll,Control_RunDLL appwiz.cpl,,3"
"Sound" = "control.exe /name Microsoft.Sound"
"Speech Recognition" = "control.exe /name Microsoft.SpeechRecognition"
"Storage Spaces" = "control.exe /name Microsoft.StorageSpaces"
"Sync Center" = "control.exe /name Microsoft.SyncCenter"
"System" = "control.exe /name Microsoft.System"
"System Icons" = "explorer shell:::{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} \SystemIcons,,0"
"System Properties" = "$env:windir\System32\SystemPropertiesComputerName.exe"
"Tablet PC Settings" = "control.exe /name Microsoft.TabletPCSettings"
"Text to Speech" = "control.exe /name Microsoft.TextToSpeech"
"User Accounts" = "netplwiz"
"Windows Defender Antivirus" = "$env:ProgramFiles\Windows Defender\MSASCui.exe"
"Windows Defender Firewall" = "control.exe /name Microsoft.WindowsFirewall"
"Windows Features" = "$env:windir\System32\OptionalFeatures.exe"
"Windows Mobility Center" = "control.exe /name Microsoft.MobilityCenter"
"Windows To Go" = "$env:windir\System32\pwcreator.exe"
"Work Folders" = "$env:windir\System32\WorkFolders.exe"
}
function Start-ControlPanelApplet {
[CmdletBinding()]
param
(
[string[]]
$Name
)
foreach ($Applet in $Name) {
cmd /c $ControlPanelApplets.$Applet
}
}
Register-ArgumentCompleter -CommandName Start-ControlPanelApplet -ParameterName Name -ScriptBlock {
param ($CommandName, $ParameterName, $WordToComplete, $CommandAst, $FakeBoundParameter)
$Keys = $ControlPanelApplets.Keys
foreach ($Key in $Keys) {
if ($Key -Match $WordToComplete) {
[System.Management.Automation.CompletionResult]::new(
"'$Key'",
$Key,
"ParameterValue",
($Key)
)
}
}
}
Set-Alias -Name cpl -Value Start-ControlPanelApplet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment