Get Internet Explorer Version Remotely

There are many ways to get Internet Explorer’s version remotely, in this post I’ll show you how to do this with Powershell and grab it from a list of machines. Let’s start with the command that does that.

If you run this on your machine, you’ll get something like this:

get-version-info

As you can see, it works and it gets Internet Explorer’s version. Now let’s see how to do it remotely for just one client:

Where COMPUTERNAME is the hostname or IP address of the remote machine. Obviously you must be running this as an administrator of the target machine or else it won’t work. So this would be it, however I will also show you 2 quick scripts to perform this on multiple machines. The first one is pretty straight forward and simple (quick script), the other one is pretty cool instead as it’ll use multithreading. ūüôā

Note that the scripts can be modified in order to get the version of any other software!

Quick script

So the quick script is easy and will get Internet Explorer’s version remotely based on a list of machines taken from Active Directory. I’ve commented the script as much as I could so that every line is explained.

Note: This is going to take ages if you’re planning to run it against loads of machines. Imagine ping one machine per time, then try accessing and grabbing IE’s version and finally adding the results to a file. Hence why the multithreading script that follows is really handy. Count that when using 200 threads (I ran it from my laptop so I didn’t care if it died) it took about 40 seconds to process 350 machines on the same network. When I ran the above script it took this time to grab info from 12 machines circa. Note that the network infrastructure is also critical. If the remote machine is located on a slow connection (for instance in another site with limited vpn connectivity) then it’ll take a bit longer to query and return the info either ways.

Multithreading script

This is my favourite. ūüôā As per what I said before, it’s really fast. Make sure you test it against a limited amount of computers to make sure it’s working correctly before waiting for the whole domain to be processed..

Gook luck!

Note:

When I say $tmp_array, it’s not an array, that’s an hash!

Read More

Get a list of services that depend on the specified service

In this post, I’m going to avoid PowerShell for a simple reason: I’ve got to fix SCCM client issues and to do that, I will need to run a script on each one of these clients. As the number of client is in the hundreads, imagine trying to run a script that is compatible with many PS versions (and this is not the difficult part), when PowerShell is installed! I’m sure the support guys will have to run through a few XP machines ūüôĀ .
Another issue wiht PS is that I would need to change the execution policy on each client. No thanks, for now at least.
If you didn’t hear enough excuses, here’s another one: yep I could run PS remotely using WMI but guess what? I need to work on stopping WMI and the services that depend on it.

I opted for a simple command line that will get a list of services that depend on the specified service:

For instance, let’s try to run this against WMI (Windows Management Instrumentation – winmgmt):

This is the result against one of my machines.

sc enumdepend winmgmt output

Now, I am a big fan of AutoIt, so I’ll be using it to capture the output from this command and have it to get a list of services that depend on the specified service, which in my case will be winmgmt. AutoIt gives me less troubles as in the end it’ll all be compiled in a single executable file. In the script below I kept a higher number of variables so that if you’re interested, you can just modify the script and start using the variable you like the most (for instance $temp_array in the script could be avoided). Normally I would have saved a couple of lines from it.

I tried to comment as much as I could to make it as simple as possible. As you can see, you can now use the content from the array names $services and for instance, run through them all in a for cycle and stop all of these services.

I personally added this to another script that will basically will try to fix the issues with the SCCM clients in the environemt. I’ll probably write an article that’ll describe the steps to do that. Obviously in my case I removed any output (MsgBox) and wrote a log instead as I will need to have the Desktops team to run this remotely and silently.

Read More

Install Wake on LAN on a NAS

I have a couple of NAS boxes and I wanted to install a Wake on LAN application on one of them so that I could turn my devices connected to the LAN through one of them. The main reason why I wanted to do this is because my home router doesn’t support Wake on WAN (so it’s not able to translate the initial request and broadcast it).
Since the NAS is always connected to the network, I can use it to turn on my home computer for instance: that’ll allow me to turn it on only when I need it.

The NAS

In my specific case I decided to install it on a Iomega IX4-200D. I believe the procedure applies to other NAS devices with just little changes. The reason why I chose this NAS is because I do have a way to get the firmware back to it even when I replace all of the Hard Drives (as it happened once already!). I’ll look at writing a procedure for that whenever I have the chance.

Step by Step instructions to Install Wake on LAN on a NAS

I will try to be as much specific as possible. Be aware that I am not responsible in case you brick your own device.

  • Enable SSH if it’s still disabled. You can follow my article that describes how to enable SSH on an Iomega/Lenovo device.
  • Connect via SSH to the NAS box. On the link I posted above, it also tells you how to login on an Iomega device.
  • Backup¬†/etc/ipkg.conf (if it exists).
    • You can backup this file using the following command:
  • Delete any existing entry in this file, or just remove the file itself by typing:
  • Add these lines one by one:

    • If you need to delete a line, press¬†ESC (enter command mode), then select the line you want to delete with the arrow keys and then type¬†dd.
    • Save the file by pressing¬†ESC to enter command mode and type

      to exit and save the changes. If you want to exit and discard the changes, type :q!
    • If you need to return in¬†insert mode press¬†i followed by an¬†Enter.
  • NAS boxes generally have an embedded OS which means they have a read only file system. So we have to use ipkg-opt to get rid of this. Run the commands below:

    • It might complain that the command isn’t recognised. In that case, try to type ipkg update.
    • Running ipkg update will give you the below result
      IX4-200D ipkg update
    • Run ipkg install ipkg-opt again
      IX4-200D ipkg install ipkg-opt
  • Run this:
  • Now backup ld.so.conf and then edit it in¬†vi.
  • Append the line below.
    • /opt/lib/
  • Close the SSH connection. This step is very important. (more…)

Read More