Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

set value to if %computername% ends with 1

Status
Not open for further replies.

swabs

IS-IT--Management
Jul 28, 2003
155
US
Hello,
I have a script that is working great posted below. I would like to add in the functionality of only running the script if the %computername% value ends with the letter "l". This indicates a laptop in our current naming scheme.
Any pointers would be appreciated.



Set objShell = WScript.CreateObject("WScript.Shell")
strDesktopFolder = objShell.SpecialFolders("AllUsersDesktop")
Set objShortCut = objShell.CreateShortcut(strDesktopFolder & _
"\Local Documents.lnk")
objShortCut.TargetPath = "c:\Documents and Settings\%username%\My Documents"
objShortCut.Description = "Run the Internet Information Services Manager."

objShortCut.Save
 
If UCase(Right(CreateObject("WScript.Network").ComputerName, 1)) <> "L" Then
WScript.Quit
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PVH for the code. Works like a charm!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top