Control Panel Access in PowerShell Version 3

A few days ago I posted the question online of how I could change the Windows 7 theme using any automated method such as .Net or even C++ which I could call from Windows PowerShell. Although I was unable to locate a solution to the problem, PowerShell version 3 did offer a compromise.


Figure 1: Get-ControlPanelItem (Click image for full-size.)


In version 3 (CTP2) two new cmdlets were added that allow interaction with the Windows Control Panel. The first cmdlet, Get-ControlPanelItem allows you to list all of the control panel applets in your system. It accepts three different parameters that allow you to retrieve the items that you want: Name, CanonicalName, and Category. The categories are the same as when you view the Control Panel in category view.

Demonstrating Get-ControlPanelItem
Figure 2: Show-ControlPanelItem (Click image for full-size.)

The second cmdlet added was Show-ControlPanelItem. As you can guess from the name it shows the specified Control Panel applet. As shown in Figure 2, you can specify either the Name or CanonicalName directly or you can pass the output from Get-ControlPanelItem. When executed the control panel applet is shown.

In my case I could not find a way to automatically set the Windows 7 theme, but I was able to use Show-ControlPanelItem Personalization to present the user with the dialog box to allow them to change the theme manually. It wasn’t the solution I was looking for but it still made the task easier to accomplish.






Enhanced by Zemanta