• December 2017
    M T W T F S S
    « Feb    
     123
    45678910
    11121314151617
    18192021222324
    25262728293031

Naming Computers in LANDesk Upgrade

Late last year I wrote an article on how to rename computers before an image is applied during LANDesk’s OSD process (read this article first if you haven’t already). Here at CSN, we PXE boot our faculty/staff computers into LANDesk’s specially configured WinPE, which launches a GUI menu of OSD tasks. These OSD tasks can be anything really, but that is a story for another article. My previous article about injecting the computer name into the Sysprep.inf file used a VBScript. I have since then upgraded to an AutoIt script that gives us more options.

PC Rename

First, let me give a brief explanation of our environment. We have a parent domain, and a child domain for students. We have four LANDesk agent configurations: one for labs and classrooms, one for office computers, one for laptops, and one for computers that don’t reside on our network. The LANDesk agent gets installed during the GUIRunOnce section of Sysprep. So, I upgraded our OSD task to prompt the technician to select which domain to join (or none), and which LANDesk agent to install. Here is the script. I won’t go through line by line like I did for the VBScript; you’ll just have to visit the AutoIt documentation website to look up some of the functions. Re-read my previous article on how I did the VBScript. The AutoIt script follows the exact same logic, but expands the idea to add more options.

#include <GUIConstantsEx.au3>

GUICreate("PC Rename", 250, 310) ; Create the GUI Window
GUICtrlCreateLabel("Enter the computer name:", 30, 10) ; Create a label
$computername = GUICtrlCreateInput("", 30, 30, 190, 20) ; Create the textbox
GUICtrlSetLimit(-1, 15) ; Limit the computer name to 15 characters
GUICtrlCreateGroup("Domain to join", 30, 60, 190, 90) ; Create the join domain "group" that surrounds the radio buttons
$optCSN = GUICtrlCreateRadio("CSN", 40, 80, 100, 20) ; Create the radio button to join the CSN domain
GUICtrlSetState(-1, $GUI_CHECKED) ; Set the CSN radio button as checked by default
$optSTUDENT = GUICtrlCreateRadio("STUDENT", 40, 100, 100, 20) ; Create the radio button to join the STUDENT domain
$optNONE = GUICtrlCreateRadio("Do not join a domain", 40, 120, 150, 20); Create the radio button to not join a domain
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group

GUICtrlCreateGroup("LANDesk Agent", 30, 150, 190, 110) ; Create the agent "group" that surrounds the radio buttons
$optStaff = GUICtrlCreateRadio("Standard Staff/Faculty", 40, 170, 150, 20) ; Create the radio button to install the Faculty Staff agent
GUICtrlSetState(-1, $GUI_CHECKED) ; Set the Faculty Staff agent radio button as checked by default
$optDeepfreeze = GUICtrlCreateRadio("Deep Freeze Required", 40, 190, 170, 20) ; Create the radio button to install the Lab Classroom agent
$optLaptop = GUICtrlCreateRadio("Laptop/Roaming", 40, 210, 150, 20); Create the radio button to install the Roaming Laptop agent
$optRural = GUICtrlCreateRadio("Rural Site", 40, 230, 150, 20); Create the radio button to install the Rural Site agent
GUICtrlCreateGroup("", -99, -99, 1, 1)  ;close group

$okbutton = GUICtrlCreateButton("OK", 100, 270, 60)	; Create the OK button
GUISetState(@SW_SHOW) ; Show the GUI

$f = FileOpen("x:\LDClient\insertname.bat", 2) ; Create the insertname.bat file

While 1 ; infinite loop that waits for the GUI to receive a message
  $msg = GUIGetMsg() ; get any user input
  
  Select
    Case $msg = $okbutton ; if the Ok button is pressed, check the options that the user selected
		If GUICtrlRead($computername) = "" Then ; if blank computer name, use the LANDesk inventory computer name for the name.
			FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf COMPUTERNAME=%Computer - Device Name%")
		Else ; else use the user input for the computer name
			FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf COMPUTERNAME=" & GUICtrlRead($computername))
		EndIf
		Select ; Chose the domain to join or not join a domain
			Case GUICtrlRead($optCSN) = $GUI_CHECKED ; Join CSN domain
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf DOMAIN=CSN")
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf NOWG=")
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf WG=;")
			Case GUICtrlRead($optSTUDENT) = $GUI_CHECKED ; Join STUDENT domain
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf DOMAIN=STUDENT")
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf NOWG=")
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf WG=;")
			Case GUICtrlRead($optNONE) = $GUI_CHECKED ; Join WORKGROUP and no domain
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf NOWG=;")
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf WG=")
		EndSelect
		Select ; Chose the Agent to isntall
			Case GUICtrlRead($optStaff) = $GUI_CHECKED ; Install the Staff faculty agent
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf AGENT=instfacst.bat")
			Case GUICtrlRead($optDeepfreeze) = $GUI_CHECKED ; Install the Lab Classroom agent
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf AGENT=instlabcl.bat")
				MsgBox(64, "Deep Freeze Reminder", "1.  Remember to run a scheduled Deep Freeze task for this computer in LANDesk Console after imaging is complete." & @CRLF & "2.  Set the System BIOS to auto power on every day at 11:00 pm.")
			Case GUICtrlRead($optLaptop) = $GUI_CHECKED ; Install the Laptop Roaming agent
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf AGENT=instlaptop.bat")
			Case GUICtrlRead($optRural) = $GUI_CHECKED ; Install the Rural agent
				FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf AGENT=instrural.bat")
		EndSelect
		ExitLoop
	Case $msg = $GUI_EVENT_CLOSE ; if the GUI is closed, the default is to name the computer using the LANDesk inventory, and not join a domain.
		FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf COMPUTERNAME=%Computer - Device Name%")
		FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf NONE=;")
		FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf WG=")
		FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf AGENT=instfacst.bat")
		ExitLoop
  EndSelect
WEnd 

AutoIt scripts can easily be converted into an executable using AutoIt’s “Compile Script to .exe” tool.

I guess I also owe an explanation on how tokreplw.exe works. You can probably get this file by downloading the trial version of LANDesk Management Suite. This command takes two inputs: a file and a pair of tokens. The file is obvious, this is the target file to look at for token replacement. The token syntax is VARIABLE=VALUE, where VARIABLE appears in your target file as %VARIABLE%, and the value is whatever you decide. For example let’s examine one line in the prename.au3 script, line 35:

FileWriteLine($f, "tokreplw c:\sysprep\sysprep.inf DOMAIN=CSN")

To help not confuse the Autoit portion of the code, we’ll break this down to the tokreplw command:

tokreplw c:\sysprep\sysprep.inf DOMAIN=CSN

So, the “c:\sysprep\sysprep.inf” file is targeted. Within this file, an occurrence of the variable %DOMAIN% will be replaced with the value of CSN, which is the name of our parent domain. If we crack open our sysprep.inf file (do an Advanced Edit in LANDesk Console), we have this:

[Identification]
%NOWG%JoinDomain=%DOMAIN%
DomainAdmin=csn\BadBoy
DomainAdminPassword=LeeroyJenkins
%WG%JoinWorkgroup=WORKGROUP

You can see the %DOMAIN% variable here. You will also notice several other variables as well. I use tokreplw to manipulate the sysprep.inf file dynamically, depending on what the technician chooses. If the tech selects to join a domain then %NOWG% becomes blank, and %DOMAIN% becomes the name of one of our two domains. The %WG% variable becomes a semicolon, which comments out the JoinWorkgroup line. If the tech does not select to join a domain, then %NOWG% becomes a semicolon, which comments out the JoinDomain line, and %WG% becomes blank. This configures the sysprep.inf file to join the computer to a workgroup instead.

Feel free to ask any questions about the script, and I will do my best to answer them.

Advertisements

Naming Computers and LANDesk OSD

LANDesk puts out a technical paper on how to accomplish Hardware Independent Imaging with its Management Suite.  If you don’t know what HII is, basically it is the process of creating a single image or imaging task that will work regardless of your hardware.  LANDesk’s tools plus Sysprep create a very easy to maintain HII imaging solution.  However, I wanted to add a little piece of of my own to this mix.

We have a newly implemented naming convention here at CSN.  This was very thoroughly thought out by many people, but more or less the naming convention identifies a computer’s location, and its asset tag number.  With the documentation on HII that LANDesk provides, a computer must be named properly in the LANDesk database, or named after the imaging task has finished.  Since our computers move from one location to another quite often, and renaming computers in the LANDesk database is not easy, I created a way for technicians to name the computer before the imaging process begins.  Once named, the computer images, and reboots into Sysprep where it joins the domain and installs all of its device drivers.  Wonderful!

Now, if you are not familiar with LANDesk, a lot of this won’t make sense.  Basically, LANDesk OSD scripts are a text file which you can alter to your liking much like any other scripting method.  Now, to get started with adding dynamic renaming to the script, I enter the following command into the LANDesk OSD script in the part just before the imaging command is executed:

REMEXEC259=sdclient /f /o /dest="X:\ldclient\pcname.vbs" /p="http://server/PC_Rename/pcname.vbs", STATUS

SDCLIENT.EXE is the swiss army knife utility of LANDesk.  It does lots of stuff.  Here it just copies a file from an HTTP share onto the WinPE environment.  I then add another line right underneath the one I just created that will execute the pcname.vbs script that was just copied from a server:

REMEXEC260=cscript x:\ldclient\pcname.vbs

So, let’s take a look at the contents of the pcname.vbs file.  Keep in mind that I do have a programming educational background, but I’ve never done any vbscripting before this, so the script may not be the most elegant vbscript around:

Dim objShell
Dim getName
Dim objFSO
Dim f


Set objShell = WScript.CreateObject("WScript.Shell")
getName = InputBox("What is the computer's name? Press Cancel to rename and rejoin the Domain later.")


set objFSO = CreateObject("Scripting.FileSystemObject")
set f = objFSO.CreateTextFile("x:\\LDClient\\insertname.bat", 2)
If getName <> "" Then
f.WriteLine("tokreplw c:\sysprep\sysprep.inf COMPUTERNAME=" & getName)
Else
f.WriteLine("tokreplw C:\sysprep\sysprep.inf COMPUTERNAME=%Computer - Device Name%")
End If
f.close

So, for a rough explanation of this vbscript.  First, an input box is called, which prompts the technician to input the computer’s name.  Whatever the user enters is returned to the variable “getName”.  A batch file is created that will get executed by the LANDesk OSD script later, “insertname.bat”.  If the user enters something, then the batch file is created with a single tokreplw command containing the text as an argument to the tokrepw command.  If the user does not enter anything, or presses cancel, then the batch file gets created with the original naming command that LANDesk put into the script originally.  I’ll go into tokreplw in a later post.

I mentioned that LANDesk creates its own naming command. Let me expand on that. By default, LANDesk attempts to find the name of the computer in the LANDesk database and name the computer for us.  The line that LANDesk puts into the OSD script when you initially create the OSD task in the LANDesk Management Suite Console looks like this (note that when you create a LANDesk OSD script, you do not see the actual text of the script. Instead, the LANDesk administrator uses a GUI wizard to create the OSD script. The OSD script can be opened in a text editor by selecting the OSD task and selecting “Advanced Edit”):

REMEXEC29=tokreplw C:\sysprep\sysprep.inf COMPUTERNAME=%Computer - Device Name%

Looks very similar to the contents of our batch file, doesn’t it?  We simply remove the command for REMEXEC29, and replace it with the execution of our batch file:

REMEXEC29=cmd /c x:\ldclient\insertname.bat

Instead of the computer getting the name that LANDesk thinks it should have, the technician can specify the name that the computer actually needs to have.  Since our computers move around a lot, their names change a lot.  This is convenient for our environment.

Well, that is all for now.  If I get a moment or two, I will try to pump out a post about the mysterious tokrepw program. 🙂

IT Gets You Down Sometimes, But It Comes With the Job

Just because one’s job location moves to a less busy, smaller location, doesn’t mean that life is simple.  Take today for example.  I started the day off with a high school teacher who couldn’t connect her digital camera via firewire to her student’s computers.  Easy fix, right?  Unfortunately not.  I worked on this for two hours before the teacher had to lock up the cameras for the day.  No drivers for the firewire cards, and no drivers for the camera available.  Just some bad software that doesn’t appear to work.  I have to go back tomorrow afternoon to work on this one.  Next, I take my lunch, then we have a mandatory meeting where a bunch of “new rules” are put into place.  This happens whenever the higher ups hear about anything that happens in the real world.  I don’t blame my manager for any of these “new rules”, it just comes with the job.

Then I attempt to contact three or four customers to close out some easy work tickets.  But its already passed 4:00, and apparently no one stays until 5:00.  So I can’t get a hold of these people, and these easy tickets continue sitting in my queue.  Ok, moving on.  I have a very nice CAD instructor, with some influence and a reputation, whose CAD installation isn’t quite perfect.  He likes things perfect.  But he is a nice guy, so I’m not stressing this one.  It just sucks that CAD doesn’t seem to work on any image I find, and so I’ll have to spend two days rebuilding it.  Oh yeah, and he mentions that he wants CAD, Solid Works, Revit, and the rest of the boys installed on his office computer (along with the latest and greatest Visual Studio 2008).  So, we’ll just bump this up to a four day project.  Not a biggy, comes with the job.

So, I go about the rest of my night, while it is quiet and slow, trying to learn how to build software packages with Symatnec’s Wise Package Package Builder.  Great looking piece of software compared to the trash package builder that LANDesk sold us.  I’m getting a lot of pressure from our management to build a package deployment solution for labs and classrooms, and move away from our Ghost imaging solution.  If I want tools that work, its up to me to research them, evaluate them, and argue that the money we’re spending admist state-wide budget cuts is worth it.  God, do I hope its worth it.

Oh, but I forgot, the boss just told me that I have to unstinall Everdream’s EDMS on every computer in our network as soon as possible.  Its been out there for a couple of years, and no one has used it.  Suddenly, this is an urgent project.  Mind you, there is no documentation on this stuff.  The isntaller doesn’t work with the /uninstall switch, and there is no other install media or MSI available for me.  No one is still around who knows anything about it except the smart guy that moved into Server Services (then again, I think he is the only one that knew anything about it from the beginning).  So, I email him and call it good for now.

Back to Wise.  While building a package for Firefox, using some great video tutorials from AppDeploy.com, I get interupted by lab assistants who are new and can’t fix the buggiest software that has has ever been spawned (GenevaLogic’s Vision), only to find out that by the time I get up from my desk, walk over to the classroom, and ask the instructor if she needs any help with this bastard of a software program, that no, she didn’t need any help.

I peacefully go back to my desk and continue working on building my first Wise MSI package, which doesn’t work.  I guess I shouldn’t have multitasked and built those last few Kiosk OSD scripts in LANDesk while also building this software package.  The damned thing does not capture the Firefox profile in the Application Data folder which I manually copied to the Default User’s profile.  By the time I fiddle with this and try a few far reaches only to find that my technique has no logical reasoning behind it, my head is pounding and my stomach is wrenching from old coffee at the school cafe. I spend the rest of my night, all fifteen minutes, making sure that the kids (I mean lab assistants) are not burning candles on the front desk, or pissing off that afore mentioned CAD instructor with over zealous yet inexperienced technical assistance.  I gather my things, and with my frustration-caused throbbing headache, head home only to sleep and come back the next day.

All in all, IT work isn’t that bad, as long as you have an outlet, and you can succeeed every now and then.  Politics, customers, technology that doesn’t work worth a shit, are all made up for when you get to be a part of something larger, or at least work on something interesting.  I mentioned that I am responsible for creating a new system of doing things at our college.  This is frustrating at times, like tonight when things don’t work, but when they do work I go home feeling like I’ve done the world some good (or at least my community).  There is a kind of rush about figuring things out, and making IT work.  Maybe tomorrow I will make some IT work, and feel good about what I’ve accomplished.  Sometimes, this also comes with the job.

Preparing 2000 College Computers for Next Semester

At College of Southern Nevada, I’ve often wondered if students, faculty, or college administration have ever thought just how the heck their college computers have received their updates, configure themselves, install software, etc.  I mean, someone or something has to do it, right?  Well, I am one of the three main Sungard employees who are actually responsible for getting this done before the start of every semester.  This blog will try to explain in layman’s terms how the College of Southern Nevada’s OTS department goes about preparing for each semester.

It all starts with three to four specifically trained computer technicians called “Imagers”.  We call ourselves Imagers because that is the process that allows us to successfully prepare 2000+ computers each semester.  Think about it.  Every month new computer updates come out.  Windows updates, the new Firefox browser release, upgrades to online learning environments like MyITLab, etc.  The list goes on!  Our job is to keep CSN up to date with the most recent versions of software.  Most of the software is requested by the instructors who use it to teach, and our faculty have always prided themselves with keeping up with the latest and greatest.  It is our job to make sure this happens.

Building images

Building images (Rob F., James, and Rob S.)

Each Imager from the three main campuses of CSN, West Charleston, Cheyenne, and Henderson, get together around this time of year to build what is called the “base image”.  An image is just that, it is a snapshot of a computer’s hardrive.  That image is then transferred to the hardrives of all of the other 2000+ computers at CSN.  Each image has to be ready at least two weeks before the beginning of the semester in time for it to be deployed to the 2000+ computers in the labs and classrooms.  We call these last two weeks, “crunch time.”

The base image is created and configured with each of the lead Imagers agreeing on what needs to go in, and how it is configured.  Every step in the installation and configuration of software is meticulously documented.

Once the base image is done, a few more “large” images need to be created.  First, we build the Oracle image.  Although Oracle is only taught on a few campuses, it must be available at all computer labs for students.

Prototypes

Our Prototypes

Next, we build the mighty CET image.  The CET image this semester includes several versions of Visual Studio, Adobe Creative Suite CS3, VMWare with a working Windows XP virtual machine, and a plethora of programming and computer teaching related tools.  After the CET and Oracle images are complete, we create another massive image for the newest version of Autodesk, ArcGIS, and lastly a Nursing image that contains specialized software for the nursing department.

Once all of the base images are done (a process that takes us around two weeks), we return to our home campuses, and begin building specific images for each computer lab pod, each computerized classroom, and smart classroom (a classroom with a projector, computer, and usually some telemedia equipment).

This process is a long one that takes months of preparation.  Often mistakes on our part, and with last minute requests from faculty, we are required to go back, reconfigure our images, and redeploy them.  Deployment of an image to a classroom usually takes around an hour or two for each room.  Depending on what else needs to be done, it may take an additional twenty to thirty minutes to finalize the classroom for use by students and faculty.  Between dozens of computerized classrooms, six large computer labs, and hundreds of smart classrooms spread out among 15 campuses, we have our work cut out for us!  I was debating about including this next picture, but it sort of displays the mental fatigue that can set in after hours of staring at a bunch of computer screens.

Time to go home

Time to go home (Rob S. and me)

Currently, the OTS department is making leaps and bounds in the implementation of new technology.  The Imaging team is no different.  We are currently in the process of implementing LANDesk Management Suite

The LANDesk Console

The LANDesk Console

to help us maintain the computerized labs and classrooms at CSN.  With this new tool, we will be able to handle the different computer hardware we have in place, use remote control to assist students and faculty with their computer problems, assist with inventory and software license tracking, and deploy software en mass upon request from faculty.  I am really excited to be a part of the planning and implementation process of the LANDesk Management Suite!

Hopefully this post has been insightful.  I know that I have enjoyed working for CSN’s “new” IT department.  Many changes have happened to us in the past, some of which were not always easy.  However, I think things at the college are working out, and I look forward to what comes next!