Check for arguments after users input

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hello all,

Im trying to create a vbs script that uses con2prt.exe to let
workstations create printer connections (and delete them). The reason
why I use this tool is because the users need to print local, but are
not allowed to save changes to there workstation (thinclients rollback
after restart). The script makes a .bat file on the home drive of the
user and starts this batch when he logs on. It works fine, but I want
to build in a error control when the user gives a wrong printer name.
The printers all start with PRT (PRT01 etc) and I want to create a
msgbox with the text "thats not a printer" when the user is not giving
the right words (PRT)in the inputbox. See the script below.

Thanks for anny input
Reitze

the script so far.............
Dim fso,file, printername, con2prt, arrInput, yesno, default
Set fso = CreateObject("SCRIPTING.FileSystemObject")
con2prt="con2prt.exe"

ask for the printername
Printername = InputBox("WHAT IS THE NAME OF THE
PRINTER:","Printername")

'here must come a error checking for the right words (prt*)

arrInput = Split(Printername, ",")
For count = 0 To UBound(arrInput)
'WScript arrInput(count)

'ask for if this is a default printer (/cd is default/connect and /c is
connect)
yesno = msgbox("Is this your default printer?", 4, "Default printer?")
if yesno = 6 then
default=" /cd" & " \\printserver\"
else
default=" /c" & " \\printserver\"
end if

'Write the batch
Set file = fso.OpenTextFile("c:\printer.bat", 8, True)
file.WriteLine con2prt & default & printername

file.Close
Set fso = Nothing
next

.



Relevant Pages

  • Re: Disable/Delete unused workstations
    ... This script will remove inactive machine accounts in Active Directory ... > is there a way to automatically disable or delete workstations not used in ...
    (microsoft.public.win2000.group_policy)
  • Re: Deploying Red Hat Workstations
    ... > can easily make changes to the workstations all at once. ... Have the central server push out to each host. ... > This script will contain any changes that I need to make. ... I would automate SCP from the server to a user account (not ...
    (Fedora)
  • Re: Change local administrator password for all PCs in the domain
    ... > I have about 200 workstations in my Windows 2000 domain. ... you could setup a custom script or Group Policy (in ... no workgroup machines. ...
    (microsoft.public.windows.server.scripting)
  • Re: Multiple WMI Connections
    ... I've run a similar system too, but I wrote my own ping provider because ... There was no particular bottleneck at a point in the script, ... script would iterate through 2000 workstations. ... Gerry Hickman ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Add domain user to local group script troubleshoot
    ... What I would like to with this is get a list of all the workstations, ... I'd like to take it one step further and have the script ... > The local group object's Add method does not understand an LDAP AdsPath. ...
    (microsoft.public.windows.server.scripting)