Windows Server – Sysprep

KB ID 0000729 

Problem

I don’t deploy large amounts of servers at once, so Windows Server sysprep is not as important as it is with the client operating systems I deploy. But I do need to create virtual machine templates, (mostly for testing), but some clients like to have server templates. I prefer to manually sysprep and shutdown a server then either convert or clone it to a template.

Thankfully sysprep is in the same place as it was with Server 2008 R2.

Solution

As before you can either run sysprep from command line by navigating to its location and running it with the correct switches. Or simply browse to it with Windows Explorer and double click it.

Related Articles, References, Credits, or External Links

Server 2008 R2 Where is Sysprep

VMware: Export a VM to OVA With PowerCLI

KB ID 0001507

Problem

It’s pretty easy to create an OVA/OVF from the vCenter Web console, but what about from Powershell / PowerCLI? Below I run though converting a 2008 x32 Windows server to OVA.

Solution

I’ll leave the web console in the background so you can see whats happening. From PowerCLI the first task is to connect to the vCenter.

[box]Connect-VIServer {vCenter-FQDN}[/box]

Supply a username and password.

Now remove any snapshots from the VM;

[box]Get-Snapshot Test-VM | Remove-Snapshot -confirm:$false[/box]

The VM needs to be off before we can export it, the following command will shut it down gracefully;

[box]Get-VM -Name Test-VM | Shutdown-VMGuest -confirm:$false[/box]

If your VM has an ISO connected to it, it can have an annoying habit of adding that to the OVA file! So remove any presented .iso files with the following command;

[box]Get-VM -Name Test-VM | Get-CDDrive | Set-CDDrive -NoMedia -confirm:$false[/box]

Finally we export our VM;

[box]Get-VM -Name Test-VM | Export-VApp -Destination ‘E:\Exported‘ -Format OVA[/box]

Related Articles, References, Credits, or External Links

NA

PowerShell: Restart Fails ‘Other Users Logged On’

KB ID 0001374

Problem

If you intend to shutdown, or restart a remote computer using PowerShell, you may see the following error message;

PS C:\> Restart-Computer “Computer-name
Restart-Computer : This command cannot be run on target computer(‘Computer-name’) due to following error: The system shutdown cannot be initiated because there are other users logged on to the computer.
At line:1 char:1
+ REstart-Computer “Computer-name
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (Computer-name:String) [Restart-Computer], InvalidOperationException
+ FullyQualifiedErrorId : RestartComputerFailed, Microsoft.PowerShell.Commands.RestartComputerCommand

Solution

You need to add the -Force flag to the command like so;

Related Articles, References, Credits, or External Links

NA

Change the default Shutdown / Log Off Option via GPO

KB ID 0000465 

Problem

Out of the box, the default power option presented to your users is shutdown. People with multiple users on their machines, may prefer the log off option to be the default.

Note: You can also set the default option to:

Shutdown
Sleep
Log off
Lock
Restart
Switch User (Unless blocked by other policy then it will revert to shutdown).
Hibernate

 

Solution

1. On your domain controller , Start > Administrative Tools > Group Policy Management Console > Either create a new policy and link it to your targeted COMPUTERS or edit an existing one, then navigate to;

[box]
User Configuration > Policies > Administrative Templates > Start Menu and Taskbar
[/box]

Locate the setting “Change Start Menu power button”.

2. Edit to the required action, i.e. Log off.

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

 

Related Articles, References, Credits, or External Links

Thanks to Seb Cerazy for the feedback

WDS Deploying Windows Part 2: Prepare Windows, and Capture to WDS

KB ID 0000737

Problem

In part one we built and configured the WDS Server. Now you need to prepare the reference Windows 8 machine so that you can ‘capture’ its image.

Solution

Before you start, make sure that the machine you are imaging has PLENTY of room on one of its local drive(s), because it copies the image locally, before it sends it to WDS.

Place Your Reference Windows 8 Machine in Audit Mode

To put all the software on your reference machine and configure it how you like, the machine needs to be in ‘Audit Mode’ before you start. There are TWO ways to put the machine into audit mode.

Note: While a machine is in audit mode, it will log on automatically as the Administrator, and every time the machine boots sysprep will launch (in anticipation of you needing it).

Option 1: A Newly Built Machine

1. When you have first built the Windows 8 machine, you will see the screen below, Press CTRL+SHIFT+F3, the machine will automatically reboot and enter audit mode.

Option 2: You Are Already in Windows

2. You can also put a Windows 8 machine into audit mode by running the sysprep executable with the /audit switch.

3. Once in Audit mode, install all the program and configure all the settings you want in your master image. When you are happy run the sysprep program, (Or simply reboot, as sysprep launches at every boot when you are in audit mode).

4. Tick the ‘Generalize’ option, select either shutdown or reboot, (If you choose reboot make sure the machine is ready to pXe boot from the network, and the boot order has the NIC BEFORE the hard drive, or sysprep will start and rebuild the machine before it’s imaged).

5. Sysprep will run, and shutdown or reboot as requested.

6. When the machine boots press F12 to boot from the WDS server.

7. Note: Now you can see why (in part one) we called the boot image ‘Capture an Image’ and the capture ‘Capture an Image’. Select the capture option.

8. WindowsPE will run at the welcome screen > Next,

Note: If the process fails at this point, usually it’s because the network card driver for this machine IS NOT in the boot image.

Adding Drivers to Images on Windows Deployment Services

9. Select the volume that you want to image, (Note: It will NOT be C: that’s reserved, usually it’s D:) > Give the image a name, this is the name you will see in the WDS console, and when you are imaging the target machines > Enter a comment/description > Next.

10. Browse.

11. Navigate to a local drive, and give the image a name with a .wim extension > Save.

12. Tick the box to upload the image > Supply IP/Name of the WDS server > Connect.

13. Supply credentials to log onto the WDS server > OK.

14. Once authenticated you can select the image group we setup in part one > Next.

15. The image will be created on the reference machine.

16. Then it will be uploaded to the WDS Server.

17. When complete click Finish. At this point the reference machine will reboot and rebuild itself.

18. Back in the Windows Deployment Services management console yo will see the image you have just uploaded in your image group.

Note: Sometimes it can take a while to appear, be patient!

Related Articles, References, Credits, or External Links

2012 – WDS Deploying Windows 8 Part 3: Carry Out a Windows 8 Unattended Deployment 2012 – WDS Deploying Windows 8 Part 1: Install and Configure WDS

 

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 – 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’