I came across a printer install script that is copied directly from Google. It installs the print driver every single time you install a new printer, which takes forever, and you have to be on the physical PC to use it.
I've tried something like the below, but get an error that my arguments are invalid.
rundll32 printui.dll,PrintUIEntry /ia /c\\PCName /m "HP Universal Printing PCL 6" /f "\\server\path\path\path\hpcu186u.inf"
I've also tried it with /K, /v, and /h in there to no avail. I can get it to run if I take out the /c and run it on the target PC, but even then I get an error about UNC paths not being supported.
I've also tried using prndrvr.vbs similarly but get an error 87 with that.
Any suggestions?
Partial answer
The fun with UNC parts should be easy:
Use pushd \\server\path to short time map a network drive to use it as a physical one. More info with pushd /?. To unmap the drive use popd.
However I am not sure in how far your script "did not work" with using the /c option as in your question. It might already have been sufficient to solve the UNC-path problem.
Related
I need to connect a lot of computers to a network printer, and I would like to send a simple batch file that do that instead of explain to each one how to use the windows wizard.
I searched on microsoft documentation and so far I can install a printer by using the printui.dll library, but only if I'm going through another computer, example:
I installed the printer through the wizard on a computer called PC1, and I set it in sharing mode, the name of the printer is PRINTER1
I can now run the command:
rundll32 printui.dll, PrintUIEntry /in /n\\PC1\PRINTER1
The problem is that in a configuration like that, if I delete the printer on PC1, every other computer will lose it too, and I can't figure out how to install the printer with his IP.
I would like something like that:
rundll32 printui.dll, PrintUIEntry /in /n 216.1.32.75 /m "Lexmark W812 (MS)" /b MY_PRINTER
When 216.1.32.75 is the printer ip, Lexmark W812(MS) is the driver needed and MY_PRINTER is the local alias of the printer.
All the computers are based on Windows 8.
I'm working with an application that was poorly designed. When installed, it creates a .INI file (remember those?) in the C:\Windows folder. In order to get things working correctly in our environment, I don't use that .INI file. Instead, I have separate .INI files in a different location where I can properly management them within the framework of the application. The problem I'm running in to is users not running the application correctly so it picks up this default .INI file that doesn't work in our environment (remember I said the application is poorly designed).
To make sure that my users are running the correct configuration, I need to delete this pesky .INI from the C:\Windows folder. I have .BAT files that manage application launch and updates so I tried to just issue a delete in the .BAT file but it isn't working. When I try to run just the delete command in a command window, I get "Access Denied". I can't rename it or move it either. I would just go touch each computer but don't have the time to get to them all.
I have just spent the last two hours googling to find a solution and the only solutions are to use Windows Explorer which isn't an option. I know it has to be something simple that I haven't been able to find. Ideas?
for /f "usebackq delims=" %A in ("%userprofile%\Desktop\ComputerName.txt") do echo Del \\%A\C$\Windows\file.ini
Computername.txt is one computer per line, names or addresses.
127.0.0.1
So I have been searching around for the answer here and am not able to find it. I'm not by any means well-versed with coding these sorts of things so excuse my noobishness.
So I am trying to create a simple batch file for deployment with a backup device for the end user to double-click and copy their profile folder to the backup media.
I am not certain if xcopy or robocopy is the best solution for this, but coming from server administration I am more familiar with robocopy. The copy utility I'm using isn't necessarily the problem, however.
What I have:
robocopy D:\%USERPROFILE% <destination> /e /copyall
While the source resolves to the user profile without issue, I have not been able to derive a variable for the destination that could account for the possibility of different from letters, which I don't think is possible. Is there a variable that sets the destination as the location from where the batch file is launched?
Thank you for the help!
Is there a variable that sets the destination as the location from
where the batch file is launched?
yes, there is:
echo %~dp0
this gives you Drive and Path of your batchfile. For more ~.modifiers see call /?
I have a batch file which uses gpresult /v and saves the output in a text file and copy that text file to a shared folder. This batch when i run on my local machine works perfectly fine but once i deploy it through SCCM it says can not open file with error code 4. I dont know what is wrong in the file.
the code is Like this:
#echo off
gpresult /v >%computername%.txt
xcopy %computername%.txt \some path
Error 4 is "The system cannot open the file.", as if the path is invalid or the open() fails for some other reason.
Do you know what directory the program is running in (CWD)?
That's where the results of gpresult are going (if the output redirection succeeds).
gpresult is not going to produce meaningful user-level data for the SYSTEM user.
Perhaps you should use gpresult /v scope computer.
Why are you using xcopy when you're only copying one file? xcopy really only has added value (over copy) if you are copying directories.
xcopy's behavior changes depending on how you specify the target. If the target ends with the directory separator (backslash), xcopy treats it like it's a directory. If it doesn't and the target doesn't exist, xcopy asks you what to do, which causes automated processes to pause indefinitely waiting for user input.
SCCM Programs Run as 'NT Authority\SYSTEM'
When SCCM (2007) runs a program, the program doesn't run as a regular user. It runs as the highest privilege user (sort of), SYSTEM.
This account is not a regular account, and many settings and environment variables that exist and are predictable for a regular user are different or do not exist for SYSTEM.
One particularly frustrating "feature" of the SYSTEM account's profile is that it is nestled away under %WINDIR%\System32, and so it is subject to filesystem redirection whenever you refer to anything relative to the profile.
Try this: use psexec -s (sysinternals) to get shell access as the SYSTEM account and run the command in that environment to see how it behaves. This is as close as we can get to an environment like the one SCCM programs run under.
When SCCM runs the command, the CWD will probably be somewhere under %WINDIR%\SysWOW64\CCM\ and may be invoked with the 32-bit version of CMD.EXE.
I have a question in regards to something similar to this. So I have an uninstall bat that runs. Due to the vendors uninstall it causes a force close of the windows explorer UI. So in haste to solve that issue I added a call to open explorer.exe. There is a problem with this as someone pointed out to me. Actually as soon as he said I knew exactly what he was saying and where he was going with his statement. Calling explorer.exe would be fine except that the bat is running under the system context not the user so when explorer is restarted it will start under the guise of the system desktop profile not the user's. I know there is way to still run under the guise of system but to restart explorer under the currently logged in user's profile.
Is there any way to copy some files from an internal online storage to a local drive by using a *.bat-file on Windows XP?
Due to some strange internal restrictions I am only allowed to use a *.bat-file to do this.
The path to the files, which are to be copied, is kinda "http://files.in-house/section/linkages"
So I tried xcopy (xcopy goto.in-house/section/linkages U:\linkages) in any variations, with quotation marks, without etc. but it does not work
a) is there any way to do this?
b) how?
Very similar to a question asked on SuperUser.com, here. The accepted answer uses vbscript, which is not installed in all WinXP systems. To check if you have it, just type cscript at a command line prompt. If you need to download it, it's here.
The number two answer relies on bitsadmin, which is not part of XP, but can be obtained with the Windows XP Service Pack 2 Support Tools.