The Deployment Guys

Helping to deploy your world automagically...

Don't clean up your image (just yet)!

Don't clean up your image (just yet)!

  • Comments 2
  • Likes

Hi all,

I thought I'd post a tip on this shiny new blog that we've created just to get the ball rolling!  We have high expectations for the content on this page, we now need to live up to them!  Anyway, the following is something I see in a lot of my deployment projects; and it often catches people out.

If you are creating a new WIM image that will have applications pre-installed and then captured, often you will want to 'clean up' the start menu and desktop in order to remove those icons that you don't want.  A very common task is to delete the contents of the %ALLUSERSPROFILE%\Start Menu\Programs\Startup folder in order to remove all the icons (for example, older versions of Microsoft Office used to place a shortcut there and so does the Adobe Acrobat Reader installer.  These shortcuts normally launch a program that caches the most common files required for these applications so that they start up quicker each time they are launched.)  To achieve this you might use the following VBS script:

Const DeleteReadOnly = TRUE

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile("%ALLUSERSPROFILE%\Start Menu\Programs\Startup\*.lnk"), DeleteReadOnly

Don't!  I often get phone calls and/or emails asking me why a previously working BDD/MDT system has stopped working without any errors left in the logs at all.  "All I did was add a simple script, honest!" is how the call normally starts.  The culprit is simple; take a look at the below image:

XPStartMenu

The shortcut "LiteTouch.lnk" is what drives your BDD/MDT process and allows it to continue after any reboots you add to the Task Sequence.  So, if you delete the contents of the folder, when your computer reboots, you'll no longer see anything happen afterwards.  Instead, you could use the following script which would still delete the contents of the folder, but leave behind the important BDD/MDT shortcut:

Dim WshShell
Set WshShell = WScript.CreateObject("Wscript.Shell")
Dim objFSO, objFldr, objFile, ShellPath
ShellPath = WshShell.ExpandEnvironmentStrings("%ALLUSERSPROFILE%")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFldr = objFSO.GetFolder(ShellPath & "\Start Menu\Programs\Startup")

For Each objFile In objFldr.Files

    If objFile.Name <> "LiteTouch.lnk" Then
        objFSO.DeleteFile(objFile.Path)
    End If
Next

Enjoy,

Daniel

This post was contributed by Daniel Oxley a consultant with Microsoft Services Spain.

  • This isn't the right place for this but I can't see how to create another thread...

    I'm having recent problems with BDD2007 image which was working. Once I choose the image I want to deploy I get the error message "The selected build does not have a valid OS source path so it cannot be installed"

    Mayby something in one of the XML files is corrupted?

    Any ideas where I start looking?

  • A Warning.. *DO NOT* delete the Startup folder itself.  For the most part you will never notice a problem, however, get your hands on an older copy of an installation using InstallShield 5 or so, and try to run the install or uninstall functions, (Nortel VPN Client for example) - It will fail with a generic error saying your "System locale is incorrect". You can test and test and always get a similar error to your system locale.   All it is, is that folder is missing.  I realize this post recommends deleting the shortcuts within, but i spent over 2 weeks trying to figure out that nortel bug because i had a script to delete this folder coming out of sysprep so i figured i would share and maybe save someone a headache :)

    -DM

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment