"Unable to initialize device" sending print command to shared printer - windows

From a Windows 2008 R2 Service Pack 1 Server I have a problem sending a print command to a network host running Windows 7 Professional which shares a printer with the network. The command I execute is the following:
> print /D:\\<hostname>\<printer_sharename> <filename>
and it doesn't work. The response is:
Unable to initialize device \\<hostname>\<printer_sharname>
If I try to execute the following command
> print /D:\\<host'sipaddress>\<printer_sharename> <filename>
from the Windows Server it works.
If I execute the command with the hostname from any other machine in the network it works.
I thought it could be a DNS problem, so I tried to check hostname with nslookup but it works, DNS server give me the right IP address.
I would use hostname instead of IP address because Microsoft Reference say to use \\ServerName\PrinterName https://technet.microsoft.com/en-us/library/cc731623.aspx
Why I'm having this behavior? Any ideas?
Thanks a lot everyone.

Analyzing the problem, there were many other problems connected to the hostname of that windows 7 machine: for example, Windows shares weren't accessible from any workstation although ping worked fine.
After many hours of tries, I resolved by changing hostname of the machine of the shared printer.
Now everything works and I can print correctly from every other computer of the network.

You should be using echo instead of print to write to the console.

Related

create react app On Your Network with WSL2 not working

I am trying to use a mobile device to view the app served by create react app. When I open the IP:PORT recommended by CRA's "On Your Network", the page never loads on my mobile device.
I am working on Windows 10 laptop, using WSL2 with Ubuntu. My network is all wifi, no ethernet cables. My code is on the Ubuntu file system and I run npm start from the same location in a WSL terminal from VS Code with the WSL extension.
I am able to see the app using http://localhost:3000 with browsers on my Windows machine (Chrome, Edge).
I noticed cmd.exe ipconfig lists the IP address that corresponds to "On Your Network" as "Ethernet adapter vEthernet (WSL)". This IP address (172.17.144.244) is different than what ipconfig shows as "Wireless LAN adapter Wi-Fi" (192.168.1.23). I also tried 192.168.1.23:3000 on my mobile device, but it didn't work either.
Some other posts on SO recommend removing a firewall setting that blocks NodeJS applications. I scrolled through the many applications listed in the firewall settings and found nothing for NodeJS apps.
Since WSL2 uses a virtual NIC what you need is enable port forwarding in the Firewall otherwise your server in WSL2 won't be seen by external PCs in your network.
I recommend reading the entire thread but in resume you can start using this script:
https://github.com/microsoft/WSL/issues/4150#issuecomment-504209723
I had the same issue. So instead of trying to restart the Windows, try to open the Powershell terminal, shut down the WSL, and then start it again. it solves to me.
Command to shut down: wsl --shutdown
Command to start: to start: wsl
Source: https://github.com/microsoft/WSL/issues/4885#issuecomment-803881561
I found a tool that fixes this problem: https://github.com/icflorescu/expose-wsl
First you need to run the command in the wsl terminal
npx expose-wsl#latest
and it gives you an ip address of your pc 192.168.0.130 for example, with that ip you can access the project from devices on the same network.
When running npm start:
.
.
.
On Your Network: http://172.48.228.88:3000
enter on mobile device:
http://192.168.0.130:3000
and works.
Note: You have to allow the port through the Windows firewall. In my case the firewall should allow access to 'C:\Program Files\WindowsApps\MicrosoftCorporationII.WindowsSubsystemForLinux_1.0.3.0_x64__...\wslhost.exe'
You can run your app in Docker instead and use Docker for Windows, enabled for WSL2. It somehow manages dynamic dynamically forward the ports, without having you to change anything in Windows.
I was also having the problem with hot reloading in WSL2 . I tried almost every solution present on github , stackoverflow and where not , from CHOKIDAR_USEPOLLING=true to setting FAST_REFRESH= false in .env file to changing network setting using netsh.... but none of them worked for me and after 2 days of searching solutions and trying to fix it .. finally reverted to wsl 1.
Just run this command on Powershell for now.
wsl --set-version Ubuntu-20.04 1
Consider Nginx for Windows.
I prefer this solution because I'm more familiar configuring web servers and reverse proxies than Windows networking and Powershell.
After unzipping the distribution, for example at C:\somepath\nginx-1.22.1, I add the following reverse proxy configuration to C:\somepath\nginx-1.22.1\conf\nginx.conf
...
http {
...
server {
listen 11500;
server_name wsl2_server;
charset utf-8;
location / {
proxy_pass http://localhost:11500/;
}
}
...
As you can see, I have a web server running on port 11500 in WSL2. When my mobile device requests "lan_ip_of_laptop:11500/", it then forwards to localhost:11500 and WSL2 server completes the request.

Port 8005 is used By Windows 10 System Process

Since today, the port 8005 is used for a Windows System Process. When i try to acces to the url http:localhost:8005 ,i can see a Blank Web Page, with no code and no info from any Web Server (No welcome web page or similar).
With the netstat command i can see that the process that uses this port is System process. Any idea why windows is using suddenly this port?
EDIT: Not duplicate question. I don't have another Tomcat installation, the problem comes from a windows process, not for another tomcat instance.
Check if port 8005 is really in use by Windows :
Install and run Sysinternals TCPView and
Check if the line with "Local Port" 8005 has as "Process" System
Or check the file c:\Windows\CCM\Logs\DeltaDownload.log for port 8005
If the port is in use by system, go to Computer Management and stop the service "SMS Agent Host" or open a command prompt as administrator and type:
sc stop CcmExec
The problems comes from a Windows Service:
https://www.niallbrady.com/2017/02/15/how-can-i-use-express-updates-when-patching-windows-10-with-quality-updates-in-system-center-configuration-manager-current-branch/
Not from another Tomcat instance.
I too was facing the same with windows 10 and ran the command netstat -a -b which showed CmRcService.exe is using the port 8005 on the machine.
The most weird part is sometimes if i hit localhost:8005 in the browser url its asking for username and password to access the page and in the developers tools I cannot see any application name or data whatsoever

Cannot create file \\server\printer

I have a module in vfp9 running under windows 7 32bits, this module prints in a local printer using the command COPY FILE file.txt TO \\server\printer, locally works fine, but in other pc of the network doesn't work, the error cannot create file \\server\printer shows.
In windows xp, this works fine, but in windows 7 not, I guess is a permission, wich one? where I can find information about this? I disabed the option "disable sharing with password protection" in advanced config of network and I can see all the shared resources, disks and printers.
I appreciate any help
That's a very 'legacy' way of printing and I wouldn't rely on it. If you have to do it this way, try redirecting an LPT port and then copying to the LPT port. At a CMD prompt:
net use lpt3 \\server\printer /yes
Then in your application
copy file file.txt to lpt3

Subversion EADDRINUSE on Mac

I have a subversion server (accessed by svn://server/directory) that I've been using for years from multiple Windows systems. I'm now doing some development on a Mac, and cannot get svn to access that server, even with a simple command such as
svn list svn://server/directory
(server and directory names change to protect the guilty)
All svn commands hang and have to be killed. (^c doesn't work, I have to ^z and kill...) Checking the console tool the last message is:
kernel: tcp_connect: inp=0xffffff801db54ac0 err=EADDRINUSE
Checking the server, the svnserve process is listening on port 3690. So I did a netstat -a on my mac, and there is nothing listed for port 3690.
That's the end of the hints I've found in a couple hours of searching. Any help would be greatly appreciated!
Thanks!
Solved! I have a DNS lookup problem. If I ping my server system, the address it tries to contact is not the IP address of that system. I added the hostname into my /etc/hosts table and voila! It now works.
Whew!

How to connect a TCP socket using a host name on a local network

I am trying to connect to a TCP socket on a Windows XP machine using the computer name from an iPad.
I've tried using:
getaddrinfo(hostName, 4097, &hints, &res0);
This fails when hostName = "MyHost" and succeeds when hostName = "192.168.0.4"
I've tried using AsynchSockets with the same results using:
[mySocket connectToHost:hostName onPort:4097 error:nil];
The XP machines do just fine connecting using:
Winsock.RemoteHost = "MyHost" for VB
and
MySocket->Connect("MyHost", 4097); for C++
How do I do something similar on the iPad using Xcode?
You're going to need an SMB client library for iOS. Here's a place to start:
http://38leinad.wordpress.com/2011/03/23/windows-filesharing-library-for-ios/
If it works with direct IP and doesn't with a hostName 'MyHost'
this most probably means that 'MyHost' isn't getting resolved (to an IP) on iPad.
For example: there's a file called hosts (usually c:\windows\system32\drivers\etc\hosts)
on an XP machine - where a host name like MyHost can have it's IP defined.
A line "192.168.0.4 MyHost" would do just that.
It seems you can't edit hosts file on non-jailbroken iPad: Can I edit an iPad's host file?
But here you can find a way around this.

Resources