Monthly Archives: January 2014

PowerShell – Get Internet Explorer Version from Remote PC

Today a colleague asked me if there is a way to get the current Internet Explorer Version of multiple Remote PC´s (He needed to make sure that all these PC´s had at least Internet Explorer 9 so that his applications would run correctly.). Of course there is a way. I used PowerShell to solve this problem. I wrote a simple PowerShell Script which gets the Internet Explorer Version from the Remote PC´s Registry. Here it is:

Param([parameter(Mandatory=$true)][alias("Computer")]$ComputerName)

$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
$RegistryKey= $Registry.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer")
$Value = $RegistryKey.GetValue("Version")

$Value

The Script above will return the Version Number of the Remote PC´s Internet Explorer when you have the appropriate permissions.

Since I wanted to make my Script a bit more useful I created a function.


function Get-IEVersion
{
Param([parameter(Mandatory=$true)][alias("Computer")]$ComputerName)

$Registry = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
$RegistryKey= $Registry.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer")
$Value = $RegistryKey.GetValue("Version")

return $Value
}

And used my new function in another Script.


Param([parameter(Mandatory=$true)][alias("Computer")]$ComputerName)

Import-Module .\Get-InternetExplorerFunctions.ps1

Get-IEVersion $ComputerName

I gave my function to my colleague and he was happy that his problem was solved.

You can download the Scripts above from here.

Sources:

http://powershell.nicoh.me/powershell-1/os/change-a-value-in-a-remote-registry

Tagged

Add www-data user to sudoers file (WANEM)

Hi. In this post I´ll show you how to add the www-data user to the sudoers file. The reason why I am blogging about this is the following: If you followed my Instructions to install WANEM like in my previous post “Installation of WANEM” you will notice that you can not apply settings to your WANEM machine via the configuration website. But why is that so?

Well, you can not apply settings to your WANEM machine via the configuration website because the user www-data who wants to apply your settings for you on the machine does not have the permissions to do so. This can be a very annoying mistake so I decided to write down the solution.

I will show you how you can solve this problem.

Before we begin I recommend that you make a backup of your current sudoers file.

sudo cp /etc/sudoers /etc/sudoers-old

Now we need to edit it.

sudo nano /etc/sudoers

You need to add the following line to the sudoers file to grant the www-data user the appropriate permissions:

www-data ALL=(ALL) NOPASSWD: ALL

That´s it. Now all you need to do is reboot your machine and try to apply your settings. It should work now.

Sources:

http://www.ogris.de/howtos/wanem.html

Tagged

Enable IP Forwarding in WANEM

In this post I will show you how you can enable IP Forwarding permanently in WANEM if you installed it to a hard disk like I have shown you in my last post “Installation of WANEM“.

Important Note: The following steps will only work if you chose debian as System like I did.

You can check if IP Forwarding is enabled with the following command:

sudo cat /proc/sys/net/ipv4/ip_forward

If you receive 0 as an answer it means that IP Forwarding is disabled. If you receive 1 as an answer it means that IP Forwarding is already enabled.

Before you perform the steps to enable IP Forwarding I would recommend you make a backup of the options file in case you want to revert the configuration. You can do this with the following command:

sudo cp /etc/network/options /etc/network/options-old

Ok. Now we will enable IP Forwarding.

The First step is to edit the options file. I used nano to edit the options file.

sudo nano /etc/network/options

You need to change this line from

ip_forward=no

to

ip_forward=yes

Now press Ctrl+O to write the changes to the file and press Ctrl+X to exit nano.

Now the last step is to restart the networking service. You can do this with this command:

sudo /etc/init.d/networking restart

That´s it. IP Forwarding is now enabled.

Sources:

http://step4wd.com/2010/01/18/enable-ip-forwarding-in-linux/

Tagged

Installation of WANEM

WANEM is used to emulate WAN links. It is often used for testing applications over long distances with high delays and packet loss. You can use WANEM running on a physical or virtual machine using the Live CD Image provided here. You can use it as it is or you can install it on your hard disk so you don´t have to do the same configurations every time.

I will show you how to install WANEM on a virtual machine using Microsoft Hyper V.

By the way: I used WANEM v2.3.

The first step is to download the WANEM Image. You can download it from here.

Now you need to create a new virtual machine. I called my virtual machine “WanEm”, assigned 512MB RAM and created a new VHDX hard disk with 10GB capacity.Create_Virtual_Machine_0Create_Virtual_Machine_1Create_Virtual_Machine_2

Now go to you virtual machine´s settings. Since the default Network adapter Hyper V assigns to virtual machines will not work you need to remove it and replace it with a “Legacy Network Adapter“.

Settings_0Settings_1

Now start you virtual machine and insert the WANEM Image you downloaded earlier.

You will be welcomed by the screen below. Press ENTER to continue.

Installation_Step_0

Installation_Step_1

If you are asked if you want to configure all interfaces via DHCP choose no. You will need to configure a static IP address later so you can access the built-in website to configure WANEM.

Installation_Step_2

Hit ESC to Exit.

If you are asked for a password for the user perc just enter a new password and confirm it by retyping it.

Now exit to the Shell by typing

exit2shell

.

To start the installation enter

knx2hd

.

Installation_Step_3

Installation_Step_4

Installation_Step_5

Choose Partition.

Installation_Step_6

Select your hard disk you created earlier. (Use SPACE to select the disk.)

Installation_Step_7

Now create a new partition. I chose to use the Template.

Installation_Step_8

Installation_Step_9

Now choose Configure Installation.

Installation_Step_10

Now choose your system. I chose debian.

Installation_Step_11

Choose the partition you want to install your system to.

Installation_Step_12

Now you will be asked what filesystem-type you want to use. I chose ext3.

After that you will be asked to create a new user and assign that user a password. And you will be asked to assign a new password to the Administrator account (root). And you need to assign a computer name.

Installation_Step_14

Next you will be asked where you want to install the boot-loader. I chose mbr.

Installation_Step_15

Now you can choose Start Installation.

Installation_Step_016

Now is the last chance to check your configuration. If you hit Next the installation will start.

Installation_Step_17

After the installation process has finished you will be asked to insert a floppy into your floppydrive. Ignore this part and choose No.

Installation_Step_18

That´s it. The installation process was successful.

Now enter

reboot

.

Your machine is now ready to use.

If you don´t want to go through all these steps by yourself you can download the VHD Image I prepared for you from here.

Sources:

http://wanem.sourceforge.net/

http://www.ogris.de/howtos/wanem.html

http://blogs.msdn.com/b/kenkilty/archive/2013/02/07/hyper-v-for-developers-part-2.aspx

http://vninja.net/virtualization/installing-and-configuring-wanem-virtual-appliance/

http://www.onemanarmy.biz/ubuntu-debian-wanem-network-setup-briged-interface.php

http://voland.su/wp-content/uploads/2013/02/wanemulator_all_about_v2.0.pdf

http://arashafiei.wordpress.com/2013/04/02/wanem-on-virtualbox/

Tagged ,