Note: that this works with all View Client versions View 4.5, 4.6 and 5.0.
Update 4-4-2011- Added the scripts and the fix windows size Powershell shell.This post is part of a Series of Posts
- VMware View 4.5 - Thin Client with PCoIP using Windows 7 (Part 1)
- VMware View 4.5 - Building the Windows 7 Thin Client (Part 2)
- VMware View 4.5 - Configuring the Local Account on the Thin Client (Part 3)
- Running Windows 7
- Using the PCoIP Protocol
- User authentication based on AD
- The Thin Client will have a replaced shell to limit the users to VMware View Client only.
- The Client can be configured to use a particular Pool or offer the user any they have access
The Thin Client only needs to be protected and run VMware View. The OS is about the only software we need installed and I'll be reploying clones of this machine so I only plan to build it once by hand. Starting with a formated machine that's same as the hardware it'll be running on in the lab. I run a fresh Windows 7 install from DVD. After the Install with normal options for your enviroment. I make the following changes.
- Updates service configured to auto update and download other microsoft updates
- Install all possible Microsoft updates
- Update any drivers
- Disable UAC
- Set for best performance
- turn off system restore points
- Enable remote desktop.
- Stop and disable the Themes Service
- Check that the newest version of Powershell is installed
- Change Power settings
- Don't password protect awaking from sleep
- Let Sleep monitor and/or machine
Creating a ViewUser and Changing its Shell
We need a Local User that we will use to run VMware View Client from. We could have users log in as themselves but I didn't for a the following reason. If we make users login to Windows. They would login to the machines, profile would be created, then View Client Launched, Authentication is passed, then finally the user is prompted for what VM they would like to access. After they select it they have to wait for it to login and create another profile. Very time consuming. We can skip all of the first profile copy issues by createing a already logged in local user. So Instead lets create the local user.
- Create Local User: ViewUser
- Set password and write it down.
- Uncheck much change password at next logon
- Check password never expires
- Check user can not change password
- No need to add user to any groups, just normal user access is fine.
- Launch Regedit while logged into an administrator account.
- Navigate to "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\IniFileMapping\system.ini\boot\"
- Change the Entry "Shell" from this:
- SYS:Software\Microsoft\Windows NT\CurrentVersion\Winlogon
- To the following
- USR:Software\Microsoft\Windows NT\CurrentVersion\Winlogon
Later we'll change the ViewUser'sShell however this change means that windows will listen to the setting when we do.
Shell Replacement Script to Launch VMware View Client
In order to control what the user gets as a shell I've created a PowerShell script to replace the Explorer.exe as the shell. The script is looks more complicated than it really is. All it really does is the following.
- Replace Windows Shell with PowerShell script.
- PowerShell script is Launched
- Script Opens VMware View
- Connect to the correct View Server
- Clear the last users username
- Make sure the window is centered
- Hide the Tool Bar while Remote window is open
- If the VMware View is exited, relaunch it.
- Optional
- Maximize View Client window if someone minimized it. (This is done by loading a user32.dll and is a little messy.)
########################### # # Purpose: Replacess The Windows Shell for VMware View Thin Client # Created By: Chris Towles # When: 04/04/2011 # Version: 1.0 # Change List # ########################### #Set-ExecutionPolicy -scope Currentuser -executionPolicy Unrestricted -WarningAction SilentlyContinue $ViewServer = "view.nku.edu" function VMwareView-ClearLastUsername { $key = "hkcu:\\Software\VMware, Inc.\VMware VDM\Client" #Clear the last user to login to View $name = "MRUsername" $RegKey = Get-ItemProperty $key $name -ErrorAction SilentlyContinue if($RegKey -ne $null){ set-itemproperty -path $key -name $name -value $null } #Delete the key so that it returns to center $name = "DialogPos" $RegKey = Get-ItemProperty $key $name -ErrorAction SilentlyContinue if($RegKey -ne $null){ set-itemproperty -path $key -name $name -value $null } #Minize the ToolBar on the remote $name = "InitialPinState" $RegKey = Get-ItemProperty $key $name -ErrorAction SilentlyContinue if($RegKey -ne $null){ set-itemproperty -path $key -name $name -value "TRUE" } else{ Set-ItemProperty -Path $key -Name $name -Value "TRUE" -ErrorAction SilentlyContinue } } function VMwareView-StartProcessToFixWindowSize { $FixWindowPSFile = "c:\Program Files\VMware\VMware View\PowerShellScripts\ThinClient\VmwareViewFixWindowSize.ps1" if( Test-Path $FixWindowPSFile ){ Start-Job -FilePath $FixWindowPSFile -Name VMwareViewFixWindowSizeLoop } else { Write-Output "The Powershell file $FixWindowPSFile wasn't found. Its needed to fix the resize issues." } } Get-Job | Stop-Job | Remove-Job #| Stop-Job | Remove-Job #$var = Stop-Job $JobList # stop any extra jobs still running #$var = Remove-Job $JobList # Remove the jobs from the list VMwareView-StartProcessToFixWindowSize $FileToRun = "C:\Program Files\VMware\VMware View\Client\bin\wswc.exe" $Arguments = @() $Arguments += "-serverURL $ViewServer" $Arguments += "-desktopProtocol PCoIP" $Arguments += "-loginAsCurrentUser no" $Arguments += "-desktopLayout fullscreeen" #$Arguments += "-desktopName `"SL100`"" while($true) { VMwareView-ClearLastUsername Start-Process $FileToRun -ArgumentList $Arguments -Wait }
########################### # # Purpose: Background process to make sure windows has a process maximized or any other setting. # Created By: Chris Towles # When: 11/12/2010 # Version: 1.0 # Change List # ########################### function VMwareView-FixWindowSize { $procList = $null $RemoteList = $null $procList = Get-Process "wswc" -ErrorAction SilentlyContinue if($procList -ne $null) { Foreach($proc in $procList){ $RemoteList = Get-Process "vmware-remotemks" -ErrorAction SilentlyContinue if($RemoteList -ne $null){ $app::ShowWindow($proc.MainWindowHandle, 3) } else { $app::ShowWindow($proc.MainWindowHandle, 9) } #shows the sizes 9- restores window , 3 is maximize #http://msdn.microsoft.com/en-us/library/ms633548(VS.85).aspx } } } $signature = @" [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); "@ $app = Add-Type -MemberDefinition $signature -Name Win32Window -ReferencedAssemblies System.Windows.Forms -Using System.Windows.Forms -Namespace test -PassThru while($true) { VMwareView-FixWindowSize sleep 30 }
Download the script and save it to the Thin Client and then edit the file. Edit the $ViewServer parameter with your own Vmware View server. I created a folder "C:\Program Files\VMware\VMware View\PowerShellScripts" in placed the script there.
This document is continued at VMware View 4.5 - Configuring the Local Account on the Thin Client (Part 3)
Hi Chris, is there a way to set a background image while in the login vmware screen?
ReplyDeletethank you...
bless your post.. :D
Busy this week with Vmware issues, will try and post the background image fix some time next week before winter break.
ReplyDeleteChris -
ReplyDeleteDid you ever post a way to put up a custom background image when using the View Client as a replacement shell in Windows 7?
Thanks!
=== Tim
What do I save the files as... .ps or .bat?
ReplyDeleteThose are PowerShell so the file extension will be ".ps1". I also just fixed the download link above as well.
ReplyDelete