tylerapplebaum.ps1

Generating Wyse $MAC.ini files


Background

Wyse thin clients use ini files to grab their settings upon startup. By default the thin clients will look in \\WDM-Server\c$\inetpub\ftproot\Wyse\wlx\ for the WYSE.ini file. This is a base file that should only contain generic settings for all thin clients, like the WDM server or the VMware View server. For individual settings, like screen resolution, a $MAC.ini file is needed. This is simply a copy of the Wyse.ini file that includes any settings that are unique to a particular thin client. The name of this file should be the MAC address of the thin client.

This post assumes you have the following:

  • A functioning Wyse Device Manager server
  • A WYSE thin client like the C50LE
  • These basic WYSE.ini files [link]
  • Some light Powershell experience
  • The script

    <#
    Usage: WyseINI.ps1 -s <HQ or RW, wherever the thin client will connect to> -m <MAC address of the thin client> -r <screen resolution you want to set (input width setting only)>
    #>
    [CmdletBinding()]
    	param (
    		[Parameter(ValueFromPipeline,Mandatory=$true, HelpMessage="Enter HQ or RW to create the INI file on Server1 or Server2")]
    		[Alias("s")]
    		[ValidateScript({If ($_ -match '^HQ' -OR '^RW') {
                $True
            } Else {
                Throw "$_ is not a valid WYSE server! Try 'HQ' or 'RW'"
            }})]
    		[string] $Server,
    		
    		[Parameter(Mandatory=$true, HelpMessage = "Please enter a valid MAC address with no semicolons. Example: 008064AAB712 (12 hex digits)")]
    		[Alias("m")]
    		[ValidatePattern("^[a-f0-9]{12}$")]
    		[string] $mac,
    		
    		[Parameter(ValueFromPipeline,Mandatory=$true, HelpMessage="Enter '1024' or '1280' or '1440' or '1920' to set the resolution of the thin client")]
    		[Alias("r")]
    		[ValidateScript({If ($_ -match '^1024' -OR '^1152' -OR '^1280' -OR '^1440' -OR '^1680' -OR '^1920') {
                $True
            } Else {
                Throw "$_ is not a valid screen resolution! Try '1024' or '1152' or '1280' or '1440' or '1680' or '1920'"
            }})]
    		[string] $Resolution
    	)
    $Rev =  "v2.1 10 Feb 2014"
    #$ErrorActionPreference="continue"
    Write-Host @'
     _       ____  _______ ______   _____   ______
    | |     / /\ \/ / ___// ____/  /  _/ | / /  _/
    | | /| / /  \  /\__ \/ __/     / //  |/ // /  
    | |/ |/ /   / /___/ / /___   _/ // /|  // /   
    |__/|__/   /_//____/_____/  /___/_/ |_/___/   
                                                  
    '@
    Write-Host $('*' * 44) -Fo Green
    Write-Host "$($MyInvocation.MyCommand.Name): Generates a unique config file for a WYSE device" -Fo Green
    Write-Host "Written By: Tyler Applebaum" -Fo Green
    Write-Host "$Rev" -Fo Green
    Write-Host $('*' * 44) -Fo Green `n
    
    #Server selection
    If ($Server -like 'HQ'){
    $server = "#Your Server Here"
    }
    
    Elseif ($Server -like 'RW'){
    $Server = "#Server number 2 here"
    }
    
    #Set mac to uppercase for filename
    $MAC = $MAC.ToUpper()
    
    #Resolution Selection
    If ($Resolution -like '1024'){
    	Write-Host "1024x768 INI file generated on $Server." -fore green`n
    	Copy-Item "\\$Server\c$\inetpub\ftproot\Wyse\wlx\1024x768.ini" "\\$Server\c$\inetpub\ftproot\Wyse\wlx\$MAC.ini"
    }
    Elseif ($Resolution -like '1152'){
    	Write-Host "1152x864 INI file generated on $Server." -fore green`n	
    	Copy-Item "\\$Server\c$\inetpub\ftproot\Wyse\wlx\1152x864.ini" "\\$Server\c$\inetpub\ftproot\Wyse\wlx\$MAC.ini"
    }
    Elseif ($Resolution -like '1280'){
    	Write-Host "1280x1024 INI file generated on $Server." -fore green`n	
    	Copy-Item "\\$Server\c$\inetpub\ftproot\Wyse\wlx\1280x1024.ini" "\\$Server\c$\inetpub\ftproot\Wyse\wlx\$MAC.ini"
    }
    Elseif ($Resolution -like '1440'){
    	Write-Host "1440x900 INI file generated on $Server." -fore green`n
    	Copy-Item "\\$Server\c$\inetpub\ftproot\Wyse\wlx\1440x900.ini" "\\$Server\c$\inetpub\ftproot\Wyse\wlx\$MAC.ini"
    }
    Elseif ($Resolution -like '1680'){
    	Write-Host "1680x1050 INI file generated on $Server." -fore green`n
    	Copy-Item "\\$Server\c$\inetpub\ftproot\Wyse\wlx\1680x1050.ini" "\\$Server\c$\inetpub\ftproot\Wyse\wlx\$MAC.ini"
    }
    Elseif ($Resolution -like '1920'){
    	Write-Host "1920x1080 INI file generated on $Server." -fore green`n	
    	Copy-Item "\\$Server\c$\inetpub\ftproot\Wyse\wlx\1920x1080.ini" "\\$Server\c$\inetpub\ftproot\Wyse\wlx\$MAC.ini"
    }