Announcement

Collapse
No announcement yet.

VBS - IF computer name begins with XXX, run script.

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS - IF computer name begins with XXX, run script.

    Basically we got 3 building locations for the company, the 3 locations begin with a different computer name (e.g. ABC, XYZ, 123).
    We got a KIXtart script which looks at the computer name and runs a map drive script based on that.
    For example:

    CASE $OFFICE = "ABC"
    SETTIME "\\TIMESERVER"
    USE X: "\\DATASERV\@USERID"

    I am basically wanting a VBS script which does something similar, if computer name begins with XYZ, then run the below script...

    Any help is much appreciated!

    Thanks,

    Andy
    Last edited by AndyBoot; 27th February 2006, 17:58.

  • #2
    Re: VBS - IF computer name begins with XXX, run script.

    Cant give you a whole script, but the critical bit would be

    Set objNet = CreateObject("WScript.Network")
    strCompName = objNet.ComputerName
    ....
    IF left(strCompName,3) = "XYZ" THEN
    ...
    END IF


    Hope this helps

    Tom
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: VBS - IF computer name begins with XXX, run script.

      Thanks!
      Worked like a treat!

      Comment

      Working...
      X