We’ve recently been having an issue where printers being deployed via group policy haven’t been deploying, or are deploying but not being set to default. So after some investigation, the easiest thing to do would be to write a Visual basic script to ease the deployment of printers throughout our environment. Luckily for us we have naming conventions and machines are usually called 2011uname or 2014uname, based on a student’s final year.
You can use this script for all sorts of things, from allocating printers and mapping network drives. To increase or decrease the amount of characters that the script looks at simply modify the strLength (Define String Check Length) variable at the beginning of the script.
'Actions based on Computer name for logon scripts 'Define String Check Length strLength = "4" 'Get the computer name Set WSHNetwork = CreateObject("WScript.Network") strComputer = WSHNetwork.ComputerName 'Select year level by ending year Select Case Left(strComputer,strLength) Case "2011" msgbox "year 12" Case "2012" msgbox "year 11" Case "2013" msgbox "year 10" End Select
The script will print out a message box, but within the case you can specify what ever action you want. Hope that helps someone out.