Hello Everyone,

Below is code we use to map over network shared printers however was
wondering if there was some VB script code I could use to put a condition on
it. The condition being, if this person logs onto computer A then the
printers are mapped over but if the same user logs into computer B then the
printers are not mapped over. Any help on this would be great.

If InGroup( "Active Directory Printer Group" ) Then
Call AddPrinter ("domain", "computername", "printer name")
objWshNetwork.SetDefaultPrinter "UNC path to printer"
End If

Thank you
Alex Anderson

Re: computer name IF statment ? by Richard

Richard
Thu Jul 19 11:30:30 CDT 2007

Alex Anderson wrote:

> Below is code we use to map over network shared printers however was
> wondering if there was some VB script code I could use to put a condition
> on
> it. The condition being, if this person logs onto computer A then the
> printers are mapped over but if the same user logs into computer B then
> the
> printers are not mapped over. Any help on this would be great.
>
> If InGroup( "Active Directory Printer Group" ) Then
> Call AddPrinter ("domain", "computername", "printer name")
> objWshNetwork.SetDefaultPrinter "UNC path to printer"
> End If
>

objWshNetwork.ComputerName will be the NetBIOS name of the local computer.
For example:

If (LCase(objWshNetwork.ComputerName) = "computera") Then
' do whatever.
End If

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--