Jump to content

FthrJACK

Patron
  • Posts

    3,264
  • Joined

  • Last visited

  • Donations

    0.00 USD 
  • Country

    United Kingdom

About FthrJACK

  • Birthday 08/02/1977

Contact Methods

  • Website URL
    http://www.paydaygo.co.uk

Profile Information

  • OS
    Server 2008 x64

Recent Profile Visitors

5,093 profile views

FthrJACK's Achievements

0

Reputation

  1. Watching The walking dead, "recorded" first 6 eps... awesome so far.. ep1 :-)

  2. Anyone suggest any good Android apps? My fave is XBMC remote.

  3. In August next year, MSFN will be TEN YEARS OLD. Thats pretty crazy! ..and still no sign of slowing down http://web.archive.org/web/20030122211912/http://www.msfn.org/
  4. CMD is a bit clunky for managing printers with imo... probably better if you switch to vbs. My machines are in OU's on AD, so say: SALES - salesprn1 - salesprn2 - salesprn3 and so on. if a user logs onto a machine and its in the SALES\salesprn1\ OU on AD, then salesprn1 printer would be their default printer, i add the other printers in the same department as well just so they have the option of printing to another one if they choose. Users then get to move around and the nearest printer to them is always their default printer. 'IMPORTANT. DO NOT user Share names to install printers. 'Use the full printer name as it appears on the servers printer menu. 'Enter "none" into printers array to install no printers. 'Do not leave array empty 'IT COMPUTERS If isMemberOu("OU=IT,OU=Admin workstations") Then printers = Array("\\GAM012\IT_COLOUR","\\GAM012\IT","\\GAM012\MARKS","\\GAM012\UNDERW2","\\GAM012\UNDERW3","\\GAM012\LOANS1","\\GAM012\LOANS2","\\GAM012\LOANS3","\\GAM012\FAXLESS1","\\GAM012\COLLECTIONS1","\\GAM012\COLLECTIONS2") defaultPrinter = "\\GAM012\IT" installPrinters = True 'LOANS1 COMPUTERS elseIf isMemberOu("OU=LOANS1,OU=Loans,OU=Workstations") Then printers = Array("\\CYC010\LOANS1","\\CYC010\LOANS2","\\CYC011\LOANS3","\\CYC010\FAXLESS1") defaultPrinter = "\\CYC010\LOANS1" installPrinters = True 'LOANS2 COMPUTERS elseIf isMemberOu("OU=LOANS2,OU=Loans,OU=Workstations") Then printers = Array("\\CYC010\LOANS1","\\CYC010\LOANS2","\\CYC011\LOANS3","\\CYC010\FAXLESS1") defaultPrinter = "\\CYC010\LOANS2" installPrinters = True 'ADMIN OFFICE COMPUTERS elseIf isMemberOu("OU=ADMIN,OU=Managerial,OU=workstations") Then printers = Array("\\GAM012\IT_COLOUR","\\GAM013\IT","\\CYC010\DALES","\\CYC010\MARKS") defaultPrinter = "\\CYC010\MARKS" installPrinters = True 'Define printers for specific machines ( we use if for laptops) ELSEIf isMemberOu("ou=laptops") Then ' get computer name Set WshNetwork = WScript.CreateObject("WScript.Network") strComputer = WshNetwork.ComputerName ' if computer name matches string then install some printers If lcase(strComputer) = lcase("laptop1") Then printers = Array("\\server\printer 1", "\\server\printer 2") defaultPrinter = "\\pabserv\Room 37" ' Define the default printer installPrinters = True ' Allows the install routines to run ElseIf lcase(strComputer) = lcase("laptop2") Then printers = Array("\\server\printer 1", "\\server\printer 2") defaultPrinter = "\\pabserv\Room 37" ' Define the default printer installPrinters = True ' Allows the install routines to run End If END IF ' **** DO NOT EDIT BELOW THIS LINE *** On Error Resume Next IF installPrinters Then 'install printers Set objWSHNetwork = CreateObject("WScript.Network") Set WS_PRINTERS = objWSHNetwork.EnumPrinterConnections Set WshShell = WScript.CreateObject("WScript.Shell") FOR EACH printer in printers if LCase(printer) <> "none" Then objWSHNetwork.AddWindowsPrinterConnection(printer) END IF NEXT 'set Default Printer if LCase(defaultPrinter) <> "none" Then objWSHNetwork.SetDefaultPrinter defaultPrinter END IF Set WS_PRINTERS = Nothing Set WS_NET = Nothing Set WshShell = Nothing END IF ' Determine OU Membership of computer Private Function isMemberOu(checkOu) Set objSysInfo = CreateObject("ADSystemInfo") strComputerDN = objSysInfo.ComputerName intIndexStart = InStr(LCase(strComputerDN), "ou=") intIndexLength = InStr(LCase(strComputerDN), ",dc=") - intIndexStart isMemberOu = false If intIndexStart > 0 Then compOu = LCase(Mid(strComputerDN, intIndexStart, intIndexLength)) End If If InStr(1, compOu, checkOu, 1) Then isMemberOu = true END IF Set objSysInfo = nothing End Function As usual, theres probably a better way of doing it - but it works. I trimmed the script example down to make it easier to follow, obviously you would need to change it to suit your own AD structure and printer paths etc.
×
×
  • Create New...