KGRKJGETMRETU895U-589TY5MIGM5JGB5SDFESFREWTGR54TY
Server : Apache/2.4.58 (Win64) OpenSSL/3.1.3 PHP/8.2.12
System : Windows NT SERVER-PC 10.0 build 26200 (Windows 11) AMD64
User : ServerPC ( 0)
PHP Version : 8.2.12
Disable Function : NONE
Directory :  C:/Windows/SysWOW64/Printing_Admin_Scripts/nb-NO/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : C:/Windows/SysWOW64/Printing_Admin_Scripts/nb-NO/pubprn.vbs
��'----------------------------------------------------------------------

'    pubprn.vbs - publish printers from a non Windows 2000 server into Windows 2000 DS

'    

'

'     Arguments are:-

'        server - format server

'        DS container - format "LDAP:\\CN=...,DC=...."

'

'

'    Copyright (c) Microsoft Corporation 1997

'   All Rights Reserved

'----------------------------------------------------------------------



'--- Begin Error Strings ---



Dim L_PubprnUsage1_text

Dim L_PubprnUsage2_text

Dim L_PubprnUsage3_text      

Dim L_PubprnUsage4_text      

Dim L_PubprnUsage5_text      

Dim L_PubprnUsage6_text      



Dim L_GetObjectError1_text

Dim L_GetObjectError2_text



Dim L_PublishError1_text

Dim L_PublishError2_text     

Dim L_PublishError3_text

Dim L_PublishSuccess1_text





L_PubprnUsage1_text      =   "Bruk: [cscript] pubprn.vbs server ""LDAP://OU=..,DC=..."""

L_PubprnUsage2_text      =   "       server en et Windows Server-navn (for eksempel Server), eller et UNC-skrivernavn  (\\Server\Printer)"

L_PubprnUsage3_text      =   "       ""LDAP://CN=...,DC=..."" er DS-banen til m�lbeholderen"

L_PubprnUsage4_text      =   ""

L_PubprnUsage5_text      =   "Eksempel 1: pubprn.vbs MyServer ""LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com"""

L_PubprnUsage6_text      =   "Eksempel 2: pubprn.vbs \\MyServer\Printer ""LDAP://CN=MyContainer,DC=MyDomain,DC=Company,DC=Com"""



L_GetObjectError1_text   =   "Feil: Bane"

L_GetObjectError2_text   =   " ikke funnet."

L_GetObjectError3_text   =   "Feil: Ingen tilgang til "



L_PublishError1_text     =   "Feil: Pubprn kan ikke publisere skrivere fra "

L_PublishError2_text     =   " fordi den kj�rer Windows 2000 eller senere."

L_PublishError3_text     =   "Kan ikke publisere skriveren "

L_PublishError4_text     =   "Feil: "

L_PublishSuccess1_text   =   "Publisert skriver:"



'--- End Error Strings ---





set Args = Wscript.Arguments

if args.count < 2 then

    wscript.echo L_PubprnUsage1_text

    wscript.echo L_PubprnUsage2_text

    wscript.echo L_PubprnUsage3_text

    wscript.echo L_PubprnUsage4_text

    wscript.echo L_PubprnUsage5_text

    wscript.echo L_PubprnUsage6_text

    wscript.quit(1)

end if



ServerName= args(0)

Container = args(1)



if 1 <> InStr(1, Container, "LDAP://", vbTextCompare) then

    wscript.echo L_GetObjectError1_text & Container & L_GetObjectError2_text

    wscript.quit(1)

end if



on error resume next

Set PQContainer = GetObject(Container)



if err then

    wscript.echo L_GetObjectError1_text & Container & L_GetObjectError2_text

    wscript.quit(1)

end if

on error goto 0







if left(ServerName,1) = "\" then



    PublishPrinter ServerName, ServerName, Container



else



    on error resume next



    Set PrintServer = GetObject("WinNT://" & ServerName & ",computer")



    if err then

        wscript.echo L_GetObjectError3_text & ServerName & ": " & err.Description

        wscript.quit(1)

    end if



    on error goto 0





    For Each Printer In PrintServer

        if Printer.class = "PrintQueue" then PublishPrinter Printer.PrinterPath, ServerName, Container

    Next





end if









sub PublishPrinter(UNC, ServerName, Container)



    

    Set PQ = WScript.CreateObject("OlePrn.DSPrintQueue.1")



    PQ.UNCName = UNC

    PQ.Container = Container



    on error resume next



    PQ.Publish(2)



    if err then

        if err.number = -2147024772 then

            wscript.echo L_PublishError1_text & Chr(34) & ServerName & Chr(34) & L_PublishError2_text

            wscript.quit(1)

        else

            wscript.echo L_PublishError3_text & Chr(34) & UNC & Chr(34) & "."

            wscript.echo L_PublishError4_text & err.Description

        end if

    else

        wscript.echo L_PublishSuccess1_text & PQ.Path

    end if



    Set PQ = nothing



end sub


Anon7 - 2021