Senin, 20 Juni 2016

PowerShell v2 Create a Centralized Folder with Desktop Management Icons

Again, another hard one to title, but, a useful trick for someone wanting to set up a new box or reimaged machine. One of our techs mentioned the God mode trick:
How to Activate GodMode in Windows 7
Thinking, "Thats a cool trick, let me PowerShell it." I came up with this intitially:
Explorer (md Test.{ED7BA470-8E54-465E-825C-99712043E01C})
Okay. Stupid pet trick, but, fun. Thinking of how I could make this more useful, however, I came up with this approach to create a new folder to house a bunch of these sorts of utility links:

# This script creates several regularly used interfaces in one folder for ease of use.
# New folder location
$storagefolder = C: estmyhappyplace
# Links to create
$folderstocreate = @(
All Tasks.{ED7BA470-8E54-465E-825C-99712043E01C},
Computer.{20D04FE0-3AEA-1069-A2D8-08002B30309D},
Computer and Devices.{F02C1A0D-BE21-4350-88B0-7367FC96EF3C},
Desktop.{00021400-0000-0000-C000-000000000046},
Install New Programs.{15eae92e-f17a-4431-9f28-805e482dafd4},
Manage Wireless Netowrks.{1FA9085F-25A2-489B-85D4-86326EEDCD87},
Network.{208D2C60-3AEA-1069-A2D7-08002B30309D},
Network Map.{E7DE9B1A-7533-4556-9484-B26FB486475E},
Recycle Bin.{645FF040-5081-101B-9F08-00AA002F954E},
Taskbar.{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9}
)
# Check to see if storage folder exists.
if(-not(Test-Path -Path $storagefolder))
{
New-Item -Path $storagefolder -ItemType Directory |
Out-Null
}
# Create folders
$folderstocreate |
ForEach-Object {
# Test to see if folder already exists
if(-not(Test-Path ($fullpath = "$($Storagefolder)$($_)")))
{
New-Item -Path $fullpath -ItemType Directory | Out-Null
}
}
# Open explorer at folder location
Invoke-Item $storagefolder
Another way to accomplish a similar task might be to copy the .cpl files from C:WindowsSystem32 directory to a new folder:
$storagefolder = C: estmyhappyplace;
Get-ChildItem C:WindowsSystem32 -Filter *.cpl |
ForEach-Object {
Copy-Item $_.FullName $storagefolder
}
Invoke-Item $storagefolder
Okay, enough silly stuff for the morning.

lamsim

About lamsim

Author Description here.. Nulla sagittis convallis. Curabitur consequat. Quisque metus enim, venenatis fermentum, mollis in, porta et, nibh. Duis vulputate elit in elit. Mauris dictum libero id justo.

Subscribe to this Blog via Email :