Run PowerShell (and Command Prompt) Administratively

KB ID 0000988

Problem

We had the ‘run as’ service way back in Windows 2000, so the concept of running a command window ‘as administrator’ should not be difficult to understand. But the amount of times I tell people ‘You need to run that as administrator’, and they reply ‘I AM an administrator’ is far too high. With PowerShell theres no way of knowing, and with command prompt the differences are subtle.

Solution

There’s a myriad of different ways to launch an administrator command window, here are a few, If I’ve missed any let me know.

Launch Powershell in Administrative Mode 

Powershell administrative mode (from Within Powershell)

If you’re already in Powershell you can open an administrative Powershell window, with the following command;

[box]

Start-Process PowerShell -Verb RunAs

[/box]

Powershell Administrative Mode (from Start Menu)

Option 1: From Start/Search > Powershell > Right Click Windows PowerShell > Run as administrator.

Option 2: Start > Right Click Windows PowerShell > Run as administrator.

Option 3: Start > Windows PowerShell > Windows Powershell > Run as Administrator.

Option 4: Right Click Start Menu (or Press Windows+X) > Window Powershell (Admin).

Powershell Administrative Mode (from Task Manager)

Launch Task Manger > File > Run new task > Powershell > Tick ‘Create this task with administrative privileges’.

Powershell Administrative Mode (from Windows Explorer)

From Windows Explorer > File > Open Windows PowerShell as administrator.

Launch Command Prompt in Administrative Mode 

Administrator Command Prompt From Start Menu. (Windows 10 and Server 2016/2019)

From the Start/Search option > Type cmd > Then right click Command Prompt and select ‘Run as administrator’.

Command Prompt (Admin) – Windows 10 (& Server 2016/2019) 

Right click the Start Button > Command Prompt (Admin)

Command Prompt (Admin) – Windows 8 (& Server 2012) Quick Links Menu

Press Windows Key+X > Select Command Prompt (Admin)

Administrator Command Prompt From Start Menu. (Windows 8 and Server 2012)

If you have the new Windows 8/2012 Start Menu (that we can’t call Metro any more) then type ‘command’ in the search window, then either right click and select ‘Run as administrator’, or press Ctrl+Shift+Enter to launch.

If you have the traditional start menu enabled or are running Windows 7/Vista, you can type command in the search/run box, then

Create An Always Run As Administrator Command Prompt Shortcut

1. Right click and empty area of your desktop > New > Shortcut.

2. Set the location to ‘cmd’ > Next > Call it Admin Command > Finish.

3. Right click your new shortcut > Properties.

4. Shortcut > Advanced > Run as administrator > Apply > OK.

 

Launch Admin Command Prompt from Task Manager.

Launch Task Manager (Ctrl+Shift+Esc) > File > Run new task > cmd > Tick ‘Create this task with administrative privileges’.

Launch Command Prompt ‘As Administrator’ From Command/Run.

I’m not a fan of this, in fact I only include it here for completeness, you can call a command windows and run it as administrator from command (or the run box (Windows Key+R). The reason I don’t like this is, you need to enter the machines local administrators password for it to work.

[box]

runas /user:%computername%administrator cmd

[/box]  

If theres any I’ve missed feel free to drop me an email, and I will update the article.

Related Articles, References, Credits, or External Links

NA

RDS – Custom Start Menu (Remove Administrative Tools)

KB ID 0001207 

Problem 

Why is it so difficult to remove Administrative tools! The one folder you might not want your users having access to is on everyones start menu by default? I’ve seen posts saying to change the permissions so users can’t run the snap-in’s in that folder, and other posts that suggest removing it from the ‘all users’ profile, and yet more posts that say remove it in preferences with a post Vista start menu. NONE OF THAT WORKED?

This solution is for Windows Server 2012 R2, if you’re running an earlier version then I invite you to post a decent solution a the bottom of the page.

What I did was create a Custom Start screen, then exported that to XML, then configured all my users to use that start screen.

Solution

Log in as an administrator, and tailor the start screen to how you would like if for your users.

Then open a PowerShell session and export the settings to an XML file. I’ve already setup a network share on the RDS server itself to store the XML file in, (grant users ‘read‘ rights to the share).

[box]

Export-StartLayout -Path \\{server-name}\{share=name}\{file-name.xml} -As xml

[/box]

Now on the GPO linked to your RDS Server(s) add the following;

[box]

Computer Configuration > Administrative Templates > Start Menu and Taskbar > Start Screen Layout

[/box]

Enable the policy, and point it to the file you exported above. Then either force a policy refresh or wait a while for the new policy to take effect.

Related Articles, References, Credits, or External Links

NA

Windows Server 2012 – RDP Server – How to get the ‘Start / Metro Screen’

KB ID 0000767

Problem

When you RDP to a server running Windows Server 2012, in Remote Desktop Services (Terminal Server) mode. How do you get the start menu up? If you press the Windows Key or Ctrl+Esc, you get the menu on YOUR Machine?

Solution

Firstly, I know it’s not called the ‘Metro Interface’ any more, but that’s what everyone calls it!

1. Drag your mouse pointer off the bottom left hand side of the screen (1) and a thumbnail of the start menu will appear (2).

2. Move the mouse pointer back to the thumbnail (3) this takes a little practice, then click the start menu thumbnail (4).

To shutdown or log off (disconnect) use the same method as you would for Windows 8 (using the charms bar).

UPDATE 04/11/13 (Credit to Thomas Dread)

1. Windows Key +R > mstsc {Enter}.
2. Show Options.
3. Local Resources TAB.
4. Keyboard > Apply Windows Key combinations “On the Remote Computer” drop down menu.

5. Back to General TAB.
6. Save or Save AS.

How Do I Shut Down Windows 8?

Related Articles, References, Credits, or External Links

NA

Disable ‘Sleep’ From the Windows Shutdown Button

KB ID 0000851 

Problem

You want to stop your users being able to select the ‘Sleep’ option from the Windows 7 power button via group policy.

Solution

1. On a domain controller Windows Key+R> gpmc.msc {enter} > The Group Policy Management Console will open.

2. Navigate to where you want to create your policy, or edit an existing one,

Note: This is a computer policy, make sure the policy is linked to an OU that contains computers NOT users.

3. Navigate to;

[box]

Computer Configuration > Administrative Templates > System > Power Management > Sleep Settings

[/box]

4. Locate the “Enable “Turn Off Hybrid Sleep” and set to Enable.

5. Locate the “Allow Standby States (S1-S3) when sleeping” and set to Disable,.

Note: There’s also an ‘on battery’ policy if you have mobile clients.

6. Then either reboot the clients, wait a couple of hours, or manually run “gpupdate /force” on them.

Note: With Server 2012 you can force all computers in an OU to refresh group policy.

Related Articles, References, Credits, or External Links

NA

Disable ‘Lock’ From the Windows Shutdown Button

KB ID 0000851 

Problem

You want to stop your users being able to select the ‘Lock’ option from the Windows 7 power button via group policy.

Solution

1. On a domain controller Windows Key+R> gpmc.msc {enter} > The Group Policy Management Console will open.

2. Navigate to where you want to create your policy, or edit an existing one.

Note: This is a computer policy, make sure the policy is linked to an OU that contains computers NOT users.

3. Navigate to;

[box]

Computer Configuration > Preferences > Windows Settings > Registry

[/box]

4. Right Click > New> Registry Item.

5. Set the following;

Action = Create.
Hive = HKEY_LOCAL_MACHINE
Key Path = SOFTWAREMicrosoftWindowsCutrrentVersionPoliciesSystem
Value name = DisableLockWorkstation
Value type = REG_DWORD
Value data = 1

 

6. Apply > OK > Close the policy editor.

7. Then either reboot the clients, wait a couple of hours, or manually run “gpupdate /force” on them.

Note: With Server 2012 you can force all computers in an OU to refresh group policy.

Related Articles, References, Credits, or External Links

NA

Windows 8 – Add Shutdown to the Start/Metro Menu

KB ID 0000744 

Problem

I wrote an article ages ago about ‘How to shut down Windows 8‘ but what if you simply want a shortcut to save you the hassle, and have that on your start menu?

Solution

1. Press Windows Key+R > In the run box type the following;

[box]
%appdata%MicrosoftWindowsStart MenuPrograms
[/box]

2. In the window that opens > Right click > New > Shortcut.

3. Enter the following

[box]
shutdown /t 00 /s[/box]

4. Call the shortcut ‘Shutdown Computer’ > Finish.

5. To change the icon > Right click > Properties > Change Icon > OK.

6. Select the shutdown icon > OK > Apply > OK.

7. And now the shutdown option is on your start menu.

7. To add shortcuts for Restart, Sleep, or Hibernate, use the following shortcuts;

[box]

TO RESTART;
shutdown.exe -t 00 -r

TO Hibernate;
rundll32.exe PowrProf.dll,SetSuspendState

TO Sleep;
rundll32.exe powrprof.dll,SetSuspendState 0,1,0

[/box]

 

Related Articles, References, Credits, or External Links

NA

Windows 8 – RSAT Tools Will Not Install?

KB ID 0000827 

Problem

For newer versions of Windows see,

Install RSAT (Remote Server Administration Tools)

I wanted the RSAT tools installing on a Windows 8 machine today, I downloaded the RSAT update and ran it, but the tools did not appear? Also they were not available under ‘Turn Windows features on or off’.

Solution

As it turns out, even though it says ‘Installation complete’ that’s not the same as Installation Successful (cheers Microsoft!). It is actually failing in the background, because this machine does not have the English (United States) language pack installed.

1. Press Windows Key+X > Control Panel > Change the View to ‘Small Icons’ > Language.

2. Add a language.

3. Under ‘E’ > English > English (United States) > Add.

4. Make sure you click the link to download and install language pack.

5. It’s over 150MB so it may take a while.

6. When installed, reinstall the Windows RSAT package for Windows 8, and this time it should be there!

 

Related Articles, References, Credits, or External Links

NA

Windows 8 – Putting Shutdown / Log Off / Restart on the Start Menu

KB ID 0000902

Problem

I’ve written before about How to shutdown Windows 8 (or 8.1). But if you actually want those options on your Start screen this is how to do it.

Note: If you are feeling especially lazy, you can download the shortcuts and skip straight to the pinning shortcuts to the start screen section.

Solution

1. On a free area of your desktop > Right click > New > Shortcut.

2. You will need to create a different shortcut for shutdown, log off, and reboot (as required) for each shortcut set the location as;

[box]

To Shutdown

shutdown -s -t 0 -f

To Log Off

shutdown -l

To Reboot

shutdown -r -t 0 f

[/box]

3. Give each of the shortcuts a name, e.g. Shutdown, Log Off, and Reboot.

4. To change the Icon the Windows Shortcuts Uses > Right click each one > Properties.

5. Change Icon.

6. Select the icon you require for each.

Note: The old Windows ‘Reboot’ Icon (circa Windows XP), is not there anymore, so I tend to use the circular arrow one.

7. Then right click each new shortcut in turn and pin them to your start menu.

8. At this point they will probably appear far right, so you may need to scroll to see them. But you can ‘drag’ them to where you want.

 

Related Articles, References, Credits, or External Links

How Do I Shut Down Windows 8?

Windows Server 2012 – RDP Server – How to get the ‘Start / Metro Screen’

 

Windows – Remove the Username (Personal Folder) From the Start Menu

KB ID 0000398

Problem

Normal users probably won’t care, but if you’re in a corporate environment or a school for example, you might not want your users having access to the personal folder in their Start Menu. The video below runs though how to remove this option on a single machine and how to remove it with Group Policy Preferences (GPP).

Solution

 

Related Articles, References, Credits, or External Links

Group Policy Preferences