hello experts,just wanna check with you if it's possible to use powershell to configure control panel options and what is the best way to do it. after installing windows, i always go into control panel and configure windows in a particular way such as changing monitor timeout and sleep timeout under power options, changing mouse options, ect. what would be the best way to accomplish this. is it done in the registry only, or is it done through some sort of object instance?also i would like to use powershell to configure start menu and taskbar settings. ultimately what i want to do is - install windows, run powershell script to customize windows settings, done. this will save a ton of time everytime i have to install windows.
You need to show what you tried and show what is and is not working.
The decision to use PS over GPO is a direct consideration. Us on the site of course are huge PS fans, but PS is not always the solution for everything.
If enterprise configuration can be done via GPO, then that is what really be used and most prudent. We know that these become registry settings, so, if GPO is not an option, then the PS registry cmdlets can be used.
There are going be situations where you are going to have to use the Windows GUI to create a setting of a staging device and export that for your automation use case.
Then there is the use of PS DSC for host configurations and maintain that configuration.
So, you are going to have to attack this one config at a time, and determine:
So, as you can see, this can get handsy, and you are going to have to think out and plan for this.
gpo, dsc...? i'm sorry but i don't know what you're talking about.
i'm just trying to find a way to automate configuring windows on a single home pc. i thought powershell might be able to do this easily but i guess not if you're mentioning other technologies. this is my first exposure to powershell and i want to know what it can and cannot do.
so if i understand you correctly, this is not something that powershell can do by itself and i may need to use other technologies too?
i'm on windows 10 pro using default ps version that comes with it.
GPO = group policy object
DSC = PowerShell Desired State Configuration.
human_error said:i'm just trying to find a way to automate configuring windows on a single home pc.
You did not state what the scenario was in your situation in your original posting. Most who come here with this sort of request are enterprise admin looking to do this on multiple computers in their organizations.
PS can do many things, and when you get creative, it can do even more. The question is, 'is what you are trying prudent for a scripting effort.'
Now, if you are just using this as a exercise for learning, this makes since. Yet, when it is just your single computer, and something which is normally a one time thing, scripting is really overkill.
PS has been part of Windows since Win7, so the fact that you are on W10 with PSv5, that's really not the issue. What is the issue is your understanding of PS and how to do what your goals are.
So, there are a lot pf built-in cmdlets to do things. For ControlPanel, all you have is this on W10,
Get-Command -Name '*ControlPanel*'
CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Get-ControlPanelItem 184.108.40.206 Microsoft.PowerShell.Management Cmdlet Show-ControlPanelItem 220.127.116.11 Microsoft.PowerShell.Management
So, nothing to allow you to set with those.
So, this is much more regarding your understanding of the core of Windows OS and where these settings are. Thus this is what these are for:
Get-Command -Name '*itemproperty*'
CommandType Name Version Source ----------- ---- ------- ------ Cmdlet Clear-ItemProperty 18.104.22.168 Microsoft.PowerShell.Management Cmdlet Copy-ItemProperty 22.214.171.124 Microsoft.PowerShell.Management Cmdlet Get-ItemProperty 126.96.36.199 Microsoft.PowerShell.Management Cmdlet Get-ItemPropertyValue 188.8.131.52 Microsoft.PowerShell.Management Cmdlet Move-ItemProperty 184.108.40.206 Microsoft.PowerShell.Management Cmdlet New-ItemProperty 220.127.116.11 Microsoft.PowerShell.Management Cmdlet Remove-ItemProperty 18.104.22.168 Microsoft.PowerShell.Management Cmdlet Rename-ItemProperty 22.214.171.124 Microsoft.PowerShell.Management Cmdlet Set-ItemProperty 126.96.36.199 Microsoft.PowerShell.Management
Control Panel does its settings in the registry as does GPO/LPO tools. You still have GPO tools on your local machine as well. Just hit the start button and type the word 'policy' and you'll see a selection of Windows policy tools. Specifically:
Yet, these are also just tools to make registry settings. So, for you to do this, you need to know what those registry settings are and use the PS registry cmdlets, and the like to set them.
There are no PS cmdlets for the Control Panel.
human_error said:ultimately what i want to do is - install windows, run powershell script to customize windows settings, done.
This sounds to me like you are reinstalling Windows ever so often for whatever your reason are, but to do what you are saying. You don't need PS to do this. You can, but you can make Windows do this for you after your first install.
When you need to reinstall Windows again later or on another machine, you just install Windows and use your configuration back up to set things back to were you were in your first install.
Heck, since Windows 8, your settings can be sync'd across PC's. Which means, if you have sync'd your settings, the next time you install Windows they sync will kick in and put things back to where they were,
Anyway, based on what your stated goals, the bulleted points above would get your there, with no PS involved, but nothing stops you from trying to do this in PS, but it will turn out to be much more work.
There are many examples some of the stuff you are after,
To export the Start layout to an .xml file 1.While signed in with the same account that you used to customize Start, right-click Start, and select Windows PowerShell. 2.At the Windows PowerShell command prompt, enter the following command: Export-StartLayout –path <path><file name>.xml 'docs.microsoft.com/en-us/windows/configuration/customize-and-export-start-layout'
but it's still export / import stuff or using PS to call native .exe or just using the .exe or .cpl directly simply by typing the .cpl name at a prompt, thus not have to open ControlPanel first and click the item of interest.
(gci C:\Windows\system32\*.cpl).Name appwiz.cpl bthprops.cpl desk.cpl Firewall.cpl hdwwiz.cpl igfxCPL.cpl inetcpl.cpl intl.cpl irprops.cpl joy.cpl main.cpl mmsys.cpl ncpa.cpl powercfg.cpl RTSnMg64.cpl sysdm.cpl TabletPC.cpl telephon.cpl timedate.cpl wscui.cpl
Well, once you have the .cpl applet open, you have to click stuff. To get and sublev .cpl stuff you have to call that directly as well.
So, again, you are going to have to go at each step in your config one item at a time, then combine that into a single script.
i'm all about efficiency. if i can do what i need to do without messing around with powershell, that's even better. i'm more of a webdeveloper. the less time i spend messing around with ps, the more time i have developing websites.
so you're saying i just need to export my registry settings and i'll be able to restore my pc to exact same config as i had before, including group policies, screen lock settings, system tray icon options, display resolution, start menu pinned items, power options....pretty much EVERYTHING?
So, this really not a PS question at all.
It’s a, if I hose up my machine, or some update does, or I get a new one, or I get hacked and have to rebuild; How do I get back to my original state with all my stuff?
Take a look at these instructions:https://support.microsoft.com/en-us/help/17127/windows-back-up-restore
Anyway, all your settings are in two places:
• The Registry • C:\Users\YourUserName\AppData (take some time a look at what is in here to see what I mean)
For example, your pinned taskbar items are here (the shortcuts) and in the registry (the hive).
C:\Users\YourUserName\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBarHKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband And you need both to get those pinned items back.
So, you really want to fully backup the registry and your user profile anyway, just because.
Here is a PS example, though it could be more through, IMHO.
Save yourself the headache and do a full backup that you can restore from. Make sure you do it when again, when you make major system changes or at minimum do a set restore point before and after you make a change.
Could one write a script get back to an original state including reinstalling all software, sure, but you’d have to know all the places there are to know to do that
so the registry backup and the user profile are not restricted? meaning i can use them to configure another pc or same pc with a different user name without windows complaining about profile access rights?
i'm already making backup images. this is for when i need to install a fresh copy of windows.
This is a great little post with some valuable tips. I totally agree. The way you bring passion and engagement into the things you do can really change your outlook on live.
- happy wheels
what the heck??? bot?