.
This commit is contained in:
25
SystemChecks/SetDefaultPrinter.bat
Normal file
25
SystemChecks/SetDefaultPrinter.bat
Normal file
@ -0,0 +1,25 @@
|
||||
@ECHO OFF
|
||||
set path=%PATH%
|
||||
|
||||
set myPrintServer=%1
|
||||
set myPrinter=%2
|
||||
|
||||
|
||||
REM Check if myPrintServer is reachable
|
||||
ping -n 1 %myPrintServer% >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo "%myPrintServer% is not reachable"
|
||||
exit /b
|
||||
)
|
||||
|
||||
REM Check if myPrinter is available
|
||||
rundll32 printui.dll,PrintUIEntry /q /t1 /n "\\%myPrintServer%\%myPrinter%" >nul 2>&1
|
||||
if errorlevel 1 (
|
||||
echo Printer %myPrinter% is not available.
|
||||
) else (
|
||||
echo Printer %myPrinter% is available.
|
||||
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -ac -p "\\%myPrintServer%\%myPrinter%"
|
||||
cscript "C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs" -t -p "\\%myPrintServer%\%myPrinter%"
|
||||
)
|
||||
|
||||
exit /b
|
||||
Reference in New Issue
Block a user