There was a time you had to go to VMware and download PowerCLI then install it, that’s no longer the case, any machine with a, (reasonably new) version of PowerShell can simply pull the commandlets down from a repository and you are ready to go.
Solution
Firstly if you have the ‘old version’ of PowerCLI you can uninstall it from Add/Remove programs (appwiz.exe).
Before installing, you need to be running Powershell version 5 or above, so issue the following command;
[box]
$psversiontable
[/box]
Below, you will see this is version 4, if yours is the same, you need to upgrade to version 5.
You can upgrade the PowerShell version by installing Windows Management Framework 5.1, like so;
Why AllowClobber? Well if you have any old commandlets hanging around, they will be updated and if you are installing on a Hyper-V server you can see some errors.
Related Articles, References, Credits, or External Links
I prefer to think of OVF Templates as “Zip” files for Virtual Machines and Virtual Appliances. Where as the OVA file is the complete appliance pre packaged. There are two things you will want to do with an OVF Template;
5. Select the disk format (Thick or Thin) you want the new VM to use.
What does Lazy Zeroed and Eager Zeroed Mean?
Data on disks is stored as a 1 (one) or a 0 (zero), so if all the blocks on the disk are set to zero, when you put data on the disk, it only has half the work to do (i.e. write the ones). Eager Zeroed, puts zeros on all the blocks on the disks straight away, LazyZeroed puts all zeroes in a block the first time the block is read.
6. Read the summary, and if you want to power on the VM on completion, tick the box > Finish.
7. Depending upon the amount of data this can take a while.
8. It will give you the following message when it’s finished.
9. And here is your VM, imported, powered up, and working.
Related Articles, References, Credits, or External Links
For newer servers I don’t really use templates anymore, but if you are deploying a lot of 2003 Windows servers in vSphere, then they can save you some time. Back in the days of vCenter 2.5 you just uploaded those sysprep files to the relevant folder in,
[box]C:Documents and SettingsAll UsersApplication DataVmwareVmware Virtual Centersysprep[/box]
But that location no longer exists (since Server 2008).
If you have a machine setup and working on your wireless network, sometimes it’s easier to set other machines up by simply migrating the settings. Either because you don’t want your child to try and type in a 64 bit WPA key, or you might simply have forgotten the WEP/WPA key,and don’t want to go through all the hassle of setting it up again.
In a small business environment you can give your colleagues their wireless settings in an XML file, or on a USB thumb drive. When using XML files you can even script the deployment of wireless settings to your users.
Solution
Option 1: Export/Import wireless Networks to XML File.
This is quick and easy, and if you are feeling adventurous enough, could be used to script the deployment of wireless networks.
1. On your working wireless machine, open a command window, the following command will list all the wireless profiles that are installed on this machine, )in the example below there is just one).
[box]netsh wlan show profiles[/box]
2. Now we know the name of the profile (Note: Typically it will be the SSID), we can export it to a folder. Be aware if the folder does not exist, the process is liable to fail.
Option 2: Export/Transfer/Import wireless Settings via USB.
1. On the source machine open ‘Control Panel’.
2. Select ‘Network and Sharing Center’.
3. Select ‘Manage wireless networks.
4. Locate the wireless profile you want to migrate, (in the example below there is just one), double click it > select ‘copy this network profile to a USB flash drive’.
5. Assuming you already have a USB drive plugged in, the wizard will detect it > Next.
6. Close.
7. Take the drive to a destination machine, and plug it in, Windows 7 has autorun disabled, with older versions of Windows you can simply choose ‘Connect to wireless network” from the autorun menu. If not open the drive and run the setupSNK.exe file.
8. Yes to confirm.
9. OK to close.
10. Your network is setup and ready to go.
Related Articles, References, Credits, or External Links
A few months ago I put in a new network at a school, they were using a vbs script to deploy all their classroom printers, and I had a quick (unsuccessful) attempt to do the same. But time was against me and I used GPP and location variables to solve the problem.
I did however take a copy of the script to have a play with, so yesterday while it was quiet I dropped a copy on the test network, and failed again! So I trawled round the internet and cobbled together a new script which works they way I wanted.
Note: Please do not email me and ask “Can you change the scripts to do xyz” you probably know as much about vbs as I do!
Solution
Requirements
1. I want the script to run and map the printers based on the OU that the computer is in, in these example I’ve only got two OU’s, but in a live environment you might want all the computers in the maths classroom to get the black and white laser printer in that classroom as the default printer and also be connected to the colour printer in the same room.
2. On my test network I’ve only got two printers, an HP 4600 Colour Laser, and an HP 3055 multifunction printer, so to illustrate how the script works I’ll map both printers to the computers in both OU’s, but I’ll change the default printer for OU1 and OU2. Both these printers are already setup and installed on my server.
Note: You may need to add x64 AND x32 bit drivers to your printers if you have a mix of client operating systems, as they download the driver from the server.
Script to Map Printers Based on OU
3. This script will remove any mapped network printers, Note: Local printers are NOT removed. It will then connect the printers you require for each OU. Lastly it will set the default printer.
Note: You need to connect the printer before you can set it as default.
[box]
'=========================================================================<br />
' MAP PRINTERS BASED ON OU<br />
'<br />
' AUTHOR: PeteLong<br />
' COMPANY: www.petenetlive.com<br />
' DATE: 03/08/12<br />
'=========================================================================<br />
Set objSysInfo = CreateObject("ADSystemInfo")<br />
strName = objSysInfo.ComputerName</p>
<p>arrComputerName = Split(strName, ",")<br />
arrOU = Split(arrComputerName(1), "=")<br />
strComputerOU = arrOU(1)</p>
<p>Set objNetwork = CreateObject("WScript.Network")</p>
<p>'=========================================================================<br />
'STEP 1 - Remove any NETWORK printers (NOT Local Printers)<br />
'=========================================================================</p>
<p>Set WshNetwork = WScript.CreateObject("WScript.Network")<br />
Set Printers = WshNetwork.EnumPrinterConnections</p>
<p>For i = 0 to Printers.Count - 1 Step 2</p>
<p> If Left(ucase(Printers.Item(i+1)),2) = "" Then<br />
WSHNetwork.RemovePrinterConnection Printers.Item(i+1)<br />
End IF<br />
Next</p>
<p>'=========================================================================<br />
'STEP 2 - Connect Printers based on COMPUTER OU membership<br />
'=========================================================================</p>
<p>Select Case strComputerOU<br />
Case "OU1"<br />
objNetwork.AddWindowsPrinterConnection "PNL-DC3055"<br />
objNetwork.AddWindowsPrinterConnection "PNL-DC4600"<br />
objNetwork.SetDefaultPrinter "PNL-DC4600"<br />
Case "OU2"<br />
objNetwork.AddWindowsPrinterConnection "PNL-DC3055"<br />
objNetwork.AddWindowsPrinterConnection "PNL-DC4600"<br />
objNetwork.SetDefaultPrinter "PNL-DC3055"<br />
End Select
[/box]
What you would need to change
Simply change PNL-DC for the name of your print server, add your OU’s and printers, you would just add a new ‘case’ for each OU you require.
4. I’m deploying this script as a USER logon script, though If you wanted you could also use a COMPUTER startup script.
What computers in OU1 would see
What computers in OU2 would see
Related Articles, References, Credits, or External Links
I’ve briefly mentioned this before when I wrote about Group Policy Preferences so when I had to do this on-site this week, I jumped straight into the group policy management console, and found that because my ODBC connection was using SQL authentication (with the SQL sa account), this would NOT WORK, (it only works with Windows authentication and even then it needs a tweak). If you are using SQL authentication jump down to the bottom of the article.
Solution
NOTE: Below I’m dealing with user DSNODBC connections, so I’m looking at User Policies, if you want to send out Machine DSNODBC connections then you need to be looking at Computer Policies.
Deploy ODBC Settings via Group Policy Preferences (Windows Authentication)
The GPP is pretty easy to locate you will find it in;
[box]
User Configuration > Preferences > Control Panel Settings > Data Sources
OR
Computer Configuration > Preferences > Control Panel Settings > Data Sources
[/box]
However you will find there is a bug in the system which means it does not deploy.
ODBC Settings fail to Deploy via GPO
1. Locate the ODBC connection that you are trying to deploy > right click > Copy.
2. Right click your desktop and ‘paste’ > You will get an XML file > Open it with notepad > Delete the username and the cpassword information > Save the file.
3. Then delete the original ODBC file from your group policy.
4. Drag the XML file into the policy, in its place > Select ‘Yes’ to import it.
WARNING: Do not open its settings/properties from this point forward, or it will break again.
Getting ODBC Settings from a Clients Registry
1. You may wish to locate and extract the ODBC settings from a working client, you can locate the settings in a working client machines registry and simply export them so you can import them on a target machine, or deploy them via GPP or logon script.
[box]
User DSN's
Computer>HKEY_CURRENT_USER>Software>ODBC>ODBC.INI
Machine DSN's
Computer>HKEY_LOCAL_MACHINE>Software>ODBC>ODBC.INI
[/box]
2. Simply right click the key that corresponds to the ‘name’ of the ODBC connector that you wish to export, > right click > Export > Save.
Deploy ODBC Settings via Group Policy Preferences (SQL Authentication)
In this example I’ve merged the ODBC connection details into the registry, you could just as easily set them up manually, as long as they exist, either on the machine you are creating the policy on, or another machine you have ‘remote registry’ rights to.
Seen when deploying images with WDS, even though you have specified language, and keyboard settings in your answerfile. The system still asks you to set the language and keyboard options. For a couple of machines you might put up with this, but for a few thousand machines it can get quite annoying!
Solution
There is a reason it’s doing this, and it’s because the next thing it asks you to do is authenticate to the WDS server like so;
if there was a problem you might not be able to log in, (because you are using complex passwords like all good sysadmins) and all those ‘special characters’ can be on lots of different keys, with lots of different languages and keyboard layouts.
So to stop it asking for language settings, set the answerfile to auto authenticate to WDS. You do this by adding the ‘Windows Deployment Services‘ sub component, from the ‘Microsoft-Windows-Setup_neutral‘ component. Add it to the ‘1 windowsPE‘ pass and fill in the credentials accordingly.
Note: This is set in the WDS Unattended answerfile, NOT the one for the image you are deploying.
Adding via System Image Manager
Adding to the Answerfile (via XML)
Related Articles, References, Credits, or External Links
In part two we built our reference machine and took an image of it using WDS. Now to automate the deployments we need to create some unattended answer files, these will answer all the questions that the Windows 8 machines will ask while they are building. We will take those files and import them into the WDS server we configured in part one. Finally to make sure everything is working we will deploy Windows 8.
Solution
Download and Install the Windows Assessment and Deployment Kit for Windows 8
1. We used to have the WAIK for Windows 7, now this has been replaced with the ADK. (download link).
2. It’s a MASSIVE download, it will take a long time.
Create a WDS Distribution Share
1. On a drive that has some room (Approx 5GB should be fine,) create a folder.
2. Launch the System Image Manager.
3. In the top left section > Right click ‘Select a Distribution Share’ > Select ‘Create Distribution Share..’
4. Navigate to the folder you created earlier.
5. Now you don’t need to do this next part, but I copy the full contents of the Windows 8 DVD into this folder as well.
6. Like so.
7. Then in the bottom left section > Right click > ‘Select Windows Image..’.
8. Navigate to the Windows 8 Media > Sources Directory > Select ‘install.wim’.
Note: The install.wim MUST match the version you are going to deploy, it’s no good pointing to a Windows 8 Pro image if you are going to deploy Windows 8 Enterprise.
9. Select the version you are going to deploy > OK.
10. This is normal, select yes to create a catalog file. It will take a while, it has to mount the image, interrogate it and create all the components. Now would be a good time to put the kettle on.
Create the Unattended file for WDS (WDSUnattended.xml)
This unattended file will be just for the WDS settings, it will not be applied to the image you are going to deploy. It sets the keyboard and language settings for WDS to use, then it gives the credentials to connect to WDS, and wipes all the partitions from the target machines hard drive. It then repartitions it ready for deployment.
WARNING: As reiterated below, the disk configuration settings below will wipe the target machines drive of ALL partitions, even manufacturers rescue partitions. If you are imaging machines anyway this should not be a problem, but don’t email me to complain of you lose the recovery files for a laptop/PC while you were practicing!
1. Create a new answer file.
2. The components may not start amd64 (if you are deploying x86 images) and some of the numbers might be different on yours. But the main titles of the components will be the same. Locate Microsoft-Windows-Internationa-Core-WinPE.
3. Add it to Pass 1. If you are unfamiliar with SIM, you add a component (or a sub component) to one of the ‘Passes’ in the center, then you can select that component (or sub component) and set the values for its settings in the top right hand section. The SIM builds an XML file in the background which will become the unattended answer file.
4. You will now see this component under pass 1, select it and set the following settings. (These are for my local English Great Britain settings, you may need to change your settings according to your locale).
Wiping the Targets Hard Drive and Partitions with WDS
6. Locate the Microsoft-Windows-Setup component > Disk Configuration sub component.
7. Add to Pass 1.
8. Right click > Insert New Disk.
9. Expand > Disk > Create Partitions > Right click > ‘Insert New CreatePartition’.
10. Select the DISK.
Disk ID = 0 WillWipeDisk = true
11. Select the Partition.
Extend = true Order = 1 Type = Primary
12. Right click ModifyPartition > Insert New ModifyPartition.
13. With the new ModifyPartition selected.
Action = AddlistItem Active = true Extend = false Format = NTFS Label = SYSTEM Letter = C Order = 1 PartitionID = 1
Select Partition to install Image to
1. Locate the WindowsDeploymentService sub component, (also in Microsoft-Windows-Setup).
2. Add to Pass 1.
3. Expand Image Selection > Install To.
Disk ID = 0 PartitionID = 1
4. Expand Login > Credentials.
Domain = {Your domain name i.e. petenetlive.com would be PETENETLIVE). Password = {Of a user with administrative rights – IT WILL GET OBFUSCATED*). Username = {Of a user with administrative rights).
*I used to say ‘encrypted‘, but thats NOT the case, they are simply Base64 encoded.
Attach the Answerfile to the WDS Server
1. Save the file you have just created.
2. Place it in your Remoteinstall folder in the WdsClientUnattend sub folder.
3. Launch the Windows Deployment Services management console > Expand Servers > Right click your server > Properties.
4. Client tab > Tick to enable unattended installation > I’m deploying x64 bit images so next to that option > Browse.
5. Navigate to and select the file you have just created > Open > Apply > OK.
Create the Unattended file for Your Image (OOBEUnattend.xml)
1. Create a new answer file.
2. Locate the Microsoft-Windows-Shell-Setup component.
3. Add to Pass 4.
4. With the component selected.
ComputerName = * CopyProfile = true (Unless you don’t want to copy the profiles from your source image). ProductKey = Your 25 character Windows 8 unlock code Note: Only put in a code of you are deploying with MAK keys or Retail Keys, if you are planning on using KMS leave this option blankRegisteredOrganization = Your business name. RegisteredOwner = Your owners name. ShowWindowsLive = false {now depreciated for Windows 8} TimeZone = GMT Standard Time Note: For other time zones see here
Automatically Join the Domain
1. Locate the Microsoft-Windows-UnattendedJoin component
2. Add to Pass 4.
3. With Identification selected.
JoinDomain = {Your domain name i.e. petenetlive.com would be PETENETLIVE). UnsecureJoin = true
Set the Image Language and Keyboard Settings
4. Locate the Microsoft-Windows-International-Core component.
Set the Local Administrator Password and Add a Local Administrator
Note: The local admin account is disabled by default, so here I’m setting the local admin’s password, and then creating a new local admin user called Sysadmin.
1. Locate the Microsoft-Windows-Shell-Setup component > UserAccounts sub component
2. Add to Pass 7.
3. With AdmnistratorPassword selected set the password value.
4. Right click LocalAccounts > Insert New LoacalAccount.
5. With LocalAccount selected.
Action = AddListItem Description = Sysadmin DisplayName = Sysadmin Group = Administrators Name = Sysadmin
6. Then set the password value.
7. Save the answer file.
8. Save the file as OOBEUnattand.xml
Attach the Answer file to the Windows 8 Image
1. Launch the Windows Deployment Services Management console.
2. Locate the Windows 8 Image you are attaching the answer file to > Right click > Properties.
3. Tick the option ‘Allow image to install in unattended mode’ > Select File > Browse.
4. Select the OOBEUnattend.xml file you created earlier.
5. Note: It makes a copy of the file and stores it elsewhere calling it ImageUnattend.xml (watch out for this if you need to edit the answer file and nothing changes!)
Deploy Your Windows 8 Image.
1. Boot your target machine to the network via pXe > Press F12 to boot from the WDS.
2. Install an Image.
3. Select the image you want to deploy.
4. After the install, the machine should reboot and present you with a domain logon.
5. And your programs and settings will be pre-configured.
Related Articles, References, Credits, or External Links
It’s been a while since I posted run through’s on WDS – they were on Server 2003, and were for deploying Windows XP.
I’ve completely re-written this page and shot a series of videos to make the process a little easier to understand.
Solution
Step 1 Notes
1. If the WDS Server is NOT the DHCP server then do NOT tick both the DHCP options, (as stated in the video), on your DHCP scope configure “DHCP Options” 66 and 67, like so;
2. If you are going to capture and deploy x64 Bit images you want to import the x64 bit boot.wim file from either the Windows 7 OR Windows Server 2008 R2 DVD (In the sources Directory).
Step 2 (Capture the Windows 7 Reference Machine).
Step 2 Notes
1. If your having trouble with talking to the WDS server over the network you may need to import the network drivers into the boot images on the WDS server, see here and here.
Computername > * (Note: Generates a random name). CopyProfile> true Registered Organization> Your Organisation Registered Owner> Your Owner ShowWindowsLive> false TimeZone> GMT Standard Time
This weekend I needed to install Windows 7 on my shiny new Acer HTPC, but having no internal CD/DVD drive I needed to do this via USB.
Quite a few times now I’ve needed to install Windows (Particularly Server 2008), on a machine that has no DVD Drive. You can now install both products from a bootable USB drive by doing either of the the following.
Note: You will need a USB Drive with enough free space on it to hold the Windows setup files (Windows 7 and Server 2008 require 4GB ish, depending on versions).
Solution
Option 1 (The quick and dirty techie way!)
1. Pop in your USB Drive > open a command windows and execute the following commands:
[box]diskpart {enter} [launches the disk partition program]
list {enter}[Displays all the disks you can work with]
select disk x {enter}[Select the USB Drive number]
clean {enter}[Wipes the USB Drive][/box]
2. Execute the following commands:
[box]create partition primary {enter} [Creates a new primary partition]
select partition 1{enter}[Select the partition you have just made]
active {enter}[Makes the partition bootable]
exit {enter}[Closes diskpart][/box]
3. Now use a utility like 7-Zip to extract the Windows Install media .ISO file to your USB drive.
4. Now boot your device from USB, (Enter the BIOS boot section and change the boot order), or press the key the machine says will load the boot options when you first turn it on.
Note: Some machines require you to change USB emulation before you can boot from them like so.