This is the first time I’ve used powershell. I’m using it in what I think is a basic mode. I’m issuing a command, redirecting the output to a file and then reading the file for the information.
The users in our company use a terminal emulator program (on Windows 10) to access our cloud system. The emulator happens to be AccuTerm. My ultimate goal is to issue a command that will return the external IP address. I’m using the following command to redirect output to a text file where I can parse it and pull out the IP address. The command is
PowerShell -Command Invoke-WebRequest ifconfig.me/ip > “C:\ABC123\External.IP.txt”
The command actually works great…from my pc. Everytime I execute it here it returns the IP address perfectly. When I released it to other users, it will work for some, and not for others. And if I go to a PC that didn’t give proper results I notice that the text file that is produced is blank. And to make matters more confusing, while testing it on a PC that didn’t work, all of a sudden it will start working perfectly and will keep working right. I don’t know if this is a coincidence or not but when I restarted this one particular PC that wasn’t giving the proper results at first but then started to give the proper results, it stopped working again after restarting.
I have a feeling that there is some basic concept that I’m missing here. Any help would be greatly appreciated.