I am working on a Virtual Printer and I'm stuck at printer installation. Installation is made by InnoSetup
[run] Filename : rundll32.exe; Parameters: "printui.dll, PrintUIEntry /if /f ""{app}\ghostscript\ghostpdf.inf"" /r ""TitusVirtualPrinter:"" /m ""Ghostscript PDF"" /b ""Virtual Printer"" /u /Y "; StatusMsg: Installing PS Printer for Ghostscript; Description: Ghostscript PS Printer; Flags: waituntilterminated shellexec;
That line works perfectly and the program installs on Windows 7 systems (Pro 32&64bits) but not in Windows 8. I don't have any error message.
could it be the same as this:
http://www.jenovarain.com/2012/12/ghostscript-printer-on-windows-8-64-bit/
perhaps they key information in that article relating to your problem is
you will want to select option #7 “Disable Driver Signature
Enforcement”
Related
I'm having trouble with a silent installation script for printers on Windows 10 1709.
We have an installation script that does the following.
Make a connection with the printserver via net use.
Import Point-To-Point registry file
Install the printers
Remove Point-To-Point registry keys and values
This works fine for our Server 2008 computers. I have to do the same trick for Windows 10 1709 computers. Only with a few (not all) printers, i get the following error.
When i install the printer by hand, it works fine. I get a popup that says i have to trust the printer. When i click on install drivers, it installs the printer. It just wont silently install.
Here are the installation scripts.
Install:
echo "Import Point And Print Settings"
reg import PointAndPrint.reg
REM Aanmelden Print Server
net use \\print01\IPC$ /USER:**** *******
echo "Install Printer Drivers"
rundll32 printui.dll PrintUIEntry /in /q /n\\print01\HPLJ-M201n-WSN-Timmerwerkplts
rundll32 printui.dll PrintUIEntry /in /q /n\\print01\Zebra-DIV-VS
rundll32 printui.dll PrintUIEntry /in /q /n\\print01\HPLJ-M127fn-CJG_WSN
rundll32 printui.dll PrintUIEntry /in /q /n\\print01\B8065-Fractiekamer
rundll32 printui.dll PrintUIEntry /in /q /n\\print01\BrotherQL720NW
rundll32 printui.dll PrintUIEntry /in /q /n\\print01\MP2401-GKW-PLOTTER
echo "Import Point and Print"
reg import RemovePointAndPrint.reg
Registry:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows NT\Printers\PointAndPrint]
"Restricted"=dword:00000001
"TrustedServers"=dword:00000001
"ServerList"="PRINT01;PRINT01.domain.local"
"InForest"=dword:00000001
"NoWarningNoElevationOnInstall"=dword:00000001
"UpdatePromptSettings"=dword:00000002
I used Procmon to see what happended when you "Trust the printserver" if you manually installed it.
This registry setting was set:
[HKEY_CURRENT_USER\Printers\LegacyPointAndPrint]
"DisableLegacyPointAndPrintAdminSecurityWarning"=dword:00000001
I am trying to add a network printer via batch file, provided I feed the data(Printer IP, Printer Name, Computer IP) into the entries.
rundll32 printui.dll,PrintUIEntry /if /b "KONICA MINOLTA C451 PS(P)" /c\\%computerNameIP% /h "x86" /f %windir%\inf\prnkm002.inf /r "IP_%computerNameIP%" /m "KONICA MINOLTA C451 PS(P)" /n\\%computerNameIP%\%printerName% /F %windir%\inf\prnkm002.inf
Now, once this command is completed, I receive the following error:
Operation could not be completed(error 0x00000032). This operation is not supported.
I ran a similar code with runs the GUI:
rundll32 printui.dll,PrintUIEntry /il /b "KONICA MINOLTA C451 PS(P)" /c\\%computerNameIP% /h "x86" /f %windir%\inf\prnkm002.inf /r "IP_%computerNameIP%" /m "KONICA MINOLTA C451 PS(P)" /n\\%computerNameIP% \%printerName% /F %windir%\inf\prnkm002.inf
and I have to choose a local local Printer: which I adjust to be TCP/IP and the drivers come default since I set it. After choosing my driver, I receive the error as well.
I just can't pinpoint what exactly isn't supported.
Windows 7 32-bit. I made adjustments to the registry, print management, group policy, but none of those seem concrete to what is preventing a remote add to a network printer.
I found another way to do it with the prncnfg.vbs files. First create the port, assign it, then manage it.
This is all located in the admin scripts in Windows folder
In the help of printui.dll,PrintUIEntry /?, we have the following examples for remotely installing printer driver with the help of /c switch.
Add printer driver using inf:
rundll32 printui.dll,PrintUIEntry /ia /c\\machine /m "Brother DCP-128C" /h "x86" /v "Type 3 - User Mode" /f c:\infpath\infFile.inf
Add printer driver using inf:
rundll32 printui.dll,PrintUIEntry /ia /K /c\\machine /m "Brother DCP-128C" /h "x86" /v 3
I am failing in getting this to work with an error code of 0x32 (This function is not supported). I am doing the following :
Using "net use" to create a connection to the remote server using the remote server's admin credentials.
Disabling the UAC in the remote machine.
Running the above command with and without /K.
I can see that it is copying the driver files into the remote machines "print$" folder but the remote installation finally fails with an error prompt with error code of 0x32.
Is there a way or a specific condition to make this thing work ? Because it is mentioned as an example in the help documentation, I think that I might be missing something.
Are there any other ways to achieve the desired task?
Microsoft Windows XP comes with a VBS script to manage local and network printers from the command line:
To Get the default printer details from command line:
cscript C:\windows\system32\prnmngr.vbs -g
To Get the list of printers added to the system from Windows command line:
cscript C:\windows\system32\prnmngr.vbs -l
Is there any equivalent commands for Windows 7? I just need to get the default printer details and get the list of printers attached to the system.
In Windows 7 these same scripts are found in
C:\Windows\System32\Printing_Admin_Scripts\en-US
List of all printers names and shows default one (You can get more details read documentation)
wmic printer get name,default
If you want output to file use:
wmic printer get name,default > D:\catalog\file.txt
Availability
The wmic command is an external command that is available in the below Microsoft operating systems as wmic.exe.
Windows XP professional
Windows 2003
Windows Vista
Windows 7
Windows 8
Windows 10
On Windows 10, the scripts are found in the same place as Windows 7.
Execute the following command to display the default printer.
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -g
Note if there is no default printer, the script will return nothing
i found mine in the sideXside folder...
C:\windows\winsxs\x86_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_6.1.7600.16385_en-us_0e83b619ada3e7ed\
i ran the following:
cscript C:\windows\winsxs\x86_microsoft-windows-p..inscripts.resources_31bf3856ad364e35_6.1.7600.16385_en-us_0e83b619ada3e7ed\prnmngr.vbs -g
it worked.
To list active printer components on Windows 8.1:
c:>cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -l | findstr "Printer name"
To remove printer in Windows 8.1:
cscript C:\Windows\System32\Printing_Admin_Scripts\en-US\prnmngr.vbs -d -p "Printer name"
I had trouble with a printer not showing in devices/printers so unable to remove it, although it was there when I pressed file > print in firefox. It was also stopping me from using the printer name for the actual installation (it bugged me having to append _1 at the end of the default printer!"
Using a batch file (no VBScript files):
#echo off
::Get printer CLSID
for /f %%a in ('reg query HKCU\Printers\Defaults') do (set regkey=%%a)
::Get printer name from the previous CLSID
for /f "tokens=3*" %%a in ('reg query %regkey%') do (set printername=%%a %%b)
echo Printer name is: %printername%
I wish that could help you
I need a way to find out what version of windows I'm running in using simple command line tools (no powershell). I need it to work from a non-privileged user, and I need to be able to parse out the difference between Windows XP, Vista, server 2008, and 7. I'm currently using:
wmic os get Caption but that fails when the user doesn't have permissions to run wmic.
Update:
To clarify, I need this command to not break with different service pack levels, etc. which probably rules out parsing a specific version number. Also if you look at this list of windows versions, you'll see that the numbers reported on Windows 7 and server 2008 r2 are the same.
I solved this problem by parsing the output of:
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"
systeminfo command shows everything about the os version including service pack number and the edition you are using.
C:\>systeminfo | findstr /B /C:"OS Name" /C:"OS Version"
OS Name: Microsoft Windows 7 Enterprise
OS Version: 6.1.7601 Service Pack 1 Build 7601
Reference: Find Windows version from command prompt
You can use ver. I'm on a school computer with a non-privileged command prompt, and it gives me Microsft Windows [Version 6.1.7601]. I'm sure you'd be able to sort out Vista and XP from the number you get.
cmd displays the Windows version when started:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Joey>_
This is also a similar line as the one ver spits out, indeed.
One option then might be
echo exit|cmd|findstr Windows
another
cmd /c ver
depending on whether you have a pipeline or not.
if not CMDEXTVERSION 2 (
echo Error: This batch requires Command Extensions version 2 or higher
exit /b 1
)
FOR /F "usebackq tokens=4 delims=] " %%I IN (`ver`) DO for /F "tokens=1,2 delims=." %%J IN ("%%I") do set WindowsVersion=%%J.%%K
if "%WindowsVersion%" LSS "6.1" (
echo Error: This batch requires Windows 7 SP1 or higher
exit /b 1
)
You can get the SysInternals and install onto your C:\ directory. After that you can then go to a command prompt and use the command PSINFO.
It is great because it lets me query any PC on the network (that I have access to). At the command prompt you type: PSINFO \exactnameofcomputer
(PSINFO whack whack exactnameofcomputer)
Then hit enter. It will take a moment or two to report back, depending on where that computer is located at.