Author Archives: Rudolf

The Mess of Mass Effect Andromeda

Well, let me start by stating I’m a huge fan of the Mass Effect universe so I’m just throwing a couple of thoughts down here on my blog. I have been playing Mass Effect ever since ME2 came out (somehow missed ME1 when it came out) but I quickly got ME1 and since have lost count how many times I’ve replayed the trilogy over and over and over again…

So of course when Andromeda came along I was as excited as any Mass Effect fan would be. I went full out and preordered the super deluxe version… because.. it’s Mass Effect why not!

Anyway, once released I immediately start playing and… shocker… I actually like it! Yes, the title of this blog entry make it seems like I’m going to moan how bad it is and so on but… no, I actually like Mass Effect Andromeda. Sure, it has it faults like the laggy multiplayer, sound track that is ‘different’ and a few little bugs (like quests getting stuck) but mostly I like it.

The problem with it though is this: lots of other people that didn’t like it and started giving the general impression that this Mass Effect game is bad. So much so that it seems even the developers/creators of it seems to be in retreat, giving up or running away (well that is the impression I’m getting). Why am I saying this:

  1. The downsizing of the development studio that created Andromeda. Yes, it may be normal some times to do this after a release of a game to have people starting to work on other projects but the timing of all of this seems a bit suspicious.
  2. Previously there were talks of a DLC/sequel related to the Quarian ark – even at the end of the game it is hinted that this must be coming. However, since then it has become awfully quiet and seems all talk about a DLC/sequel has disappeared. Perhaps they are busy with it somewhere is secret but the silence plus downsizing together… is making us fans start to worry a bit.

Well, lets hope I’m wrong to worry about this and there will be some more (new) Mass Effect in the future. We would like to know what happen to our Pathfinder and the team plus what the Quarians are up to! Please Bioware, don’t disappoint!

Child0fThessia

CodePlex shutting down

So with all good things in life I recently learned that CodePlex is shutting down. This is of course a huge bummer for me as a number of my projects have source code that is hosted there.

Particularly QuickMon would be affected. I’ve already moved the source code repository over to GitHub (https://github.com/RudolfHenning/QuickMon) and will be moving the rest over the coming weeks until the whole project is live there. There is also the problem that all current versions of QuickMon 4 points to CodePlex for checking for new version updates but I’ll release one last version or version 4 pointing to the new repository – hopefully soon.

The rest of my projects will be moved as well as time permits. Wish me luck…

SSH from PowerShell

I’ve been playing with more non Microsoft technologies recently and even have a few Linux VMs running here and there. In the process I’ve learned a lot about interacting between the two worlds/environments using technologies like SSH and even running the Powershell Alpha previews on my Linux VMs. Then I got ‘bored’ and looked for a way to programmatically interact with my VMs (for monitoring) and discovered the open source project SSH.Net which I now have incorporated into even QuickMon. Then I got even more bored and started looking for a way to use SSH from Powershell and came across the SSH-Sessions module which incidentally also use SSH.Net to give Powershell a way to call/connect using SSH.

No PassPhrase

This all works nicely except… SSH-Sessions had one shortcoming.. which I just had to fix. The creator(s) of this module implements a way to specify a key file when connecting to an SSH server but does not provide a way to specify the ‘PassPhrase’ at all! WHY?

Any way, I knew the SSH.Net library does support it since I actually make use of this functionality in QuickMon. Then I started digging inside the SSH-Session script files and made a few adjustments…

Fix

To enable PassPhrase functionality I simply had to add the following code in the ‘New-SshSession’ function:

Change the function header to:

function New-SshSession {
    param([Parameter(Mandatory=$true)][string[]] $ComputerName,
          [Parameter(Mandatory=$true)][string]   $Username,
          [string] $KeyFile = '',
          [string] $PassPhrase = 'blankPassphrase',
          [string] $Password = 'SvendsenTechDefault', # I guess allowing for a blank password is "wise"...          
          [int] $Port = 22,
          [switch] $Quiet
    )

and then inside the function:

if ($KeyFile -ne '') {
        if (-not $Quiet) {
            "Key file specified. Will override password. Trying to read key file..."
        }
        if ($PassPhrase -eq 'blankPassphrase') {
            $SecurePassPhrase = Read-Host -AsSecureString "key provided. Please enter pass phrase for $KeyFile"
            $PassPhrase = ConvertFrom-SecureToPlain $SecurePassPhrase
        }
        if (Test-Path -PathType Leaf -Path $Keyfile) {
            $Key = New-Object Renci.SshNet.PrivateKeyFile( $Keyfile, $PassPhrase ) -ErrorAction Stop
        }
        else {
            "Specified keyfile does not exist: '$KeyFile'."
            return
        }   
    }

Example

And with the you can now use the module to connect to SSH using a Key file that has a PassPhrase. If you don’t specify the PassPhrase the script will prompt you for one. If you actually don’t have a PassPhrase at all then pass an empty string as the value of PassPhrase (not tested but it should work).

Import-Module SSH-Sessions
New-SshSession -Computer mySSHServer -Username me  -KeyFile 'c:\mykeys\mykey.key' -PassPhrase 'somePhrase'
Invoke-SshCommand  -ComputerName mySSHServer -Command "cat /proc/cpuinfo | grep processor" -Quiet
Remove-SshSession -RemoveAll -Quiet

How to install Powershell on Ubuntu 16.10

I recently tried installing the latest Alpha of Powershell (Alpha 12) on the newly released Ubuntu 16.10 and discovered that the install failed because of a dependency on the library libicu55 which has been replaced in the new version of Ubuntu (libicu57). Actually, the whole .Net Core install fails because of this.

Fortunately this is easy to fix by manually installing the old library from http://cz.archive.ubuntu.com/ubuntu/pool/main/i/icu/libicu55_55.1-7_amd64.deb

Then you can download the latest Powershell version (Alpha 12 as of this writing) from https://github.com/PowerShell/PowerShell/releases

Hopefully the creators of the Powershell packages will release an updated version that is natively compatible with Ubuntu16.10.

 

SCOM agent Info script

When you have a case where you start integrating your in house SCOM 2012 R2 environment with VMs that are hosted in Azure and ‘other’ people keep on screwing up your SCOM agents with the OMS version you need a way to track what version is actually installed on a machine – plus whether the original SCOM 2012 R2 config is still in tact – which is  not the case since the upgrade process from SCOM 2012 R2 agent to the OMS version totally screws up the SCOM 2012 R2 config (like in F*ing deletes it !!!)

Therefore I had to create a little Powershell script to help check suspected machines if they have been affected by this issue. From the SCOM console side it just appears the Agent is ‘dead’ even though if you check manually it is still running (but of course the config is gone).

if ($args.count -ne 0) {
    $ComputerName = $args[0]    
}
else {
    $ComputerName = Read-Host -Prompt 'Computer Name'
}

$pingTest = (Test-Connection $ComputerName -Count 1 -TTL 255 -ErrorAction SilentlyContinue) 
if ($pingTest -ne $null -and $pingTest.IPV4Address -ne $null){
    write-host "IP Address : " $pingTest.IPV4Address.IPAddressToString -foregroundcolor "green"
    $serviceDetails = Get-Service -ComputerName $ComputerName | where DisplayName -Like 'Microsoft Monitoring Agent'
    if ($serviceDetails -ne $null ) {
        write-host "Health Service state: " $serviceDetails.Status.ToString() -foregroundcolor "green"

        $Reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $ComputerName)
        $AgentGroupKeys = $Reg.OpenSubKey("SYSTEM\CurrentControlSet\Services\HealthService\Parameters\Management Groups")
        write-host "Groups: " $AgentGroupKeys.SubKeyCount.ToString() -foregroundcolor "green"
        $AgentGroupKeys.GetSubKeyNames() | % {
            if ($_ -like "AOI*") {
                write-host " OMS" -foregroundcolor "yellow"
            } else {
                write-host " $_" -foregroundcolor "green"
            }            
        }        
        
        $VersionNo = "NOT found!"
        $RegKeyProducts = $Reg.OpenSubKey("SOFTWARE\Classes\Installer\Products")
        $RegKeyProducts.GetSubKeyNames() | % {
            $RegKeyProduct = $Reg.OpenSubKey("SOFTWARE\Classes\Installer\Products\" + $_)
            if ($RegKeyProduct.GetValue('ProductName') -eq "Microsoft Monitoring Agent") {
                $VersionNo = $RegKeyProduct.GetValue('Version').ToString("X")
            }
        }

        if ($VersionNo -ne "NOT found!") {
            write-host "Agent version" $VersionNo -foregroundcolor "green"
        }
        else {
            write-host "Agent version not found!" -foregroundcolor "red"
        }

    }
    else {
        write-host "Health service NOT found!" -foregroundcolor "red"
    }
}
else {
    write-host "$ComputerName is not pingable!" -foregroundcolor "red"
}

This script first checks whether the machine (VM) is pingable, if it is then whether the HealthService service is installed, if so what state it is in and what version it is. It also lists the management groups the agent reports to including OMS.

Have fun kidz…

Hiding passwords in (C# App) console

I’m actually a bit surprised that despite .Net/C# being more than 10 years old there is still no native Console.ReadLine() overload that hides the characters you are tying – for when you want to prompt for a password or so. Of course writing your own version to do this is not really difficult but still it would have been nice…

Here is one quick version… in case someone else wants to have one (and is too lazy to create it from scratch) hehe.

 

        private static string GetPwd()
        {
            string pass = "";
            Console.Write("Enter your password: ");
            ConsoleKeyInfo key;

            do
            {
                key = Console.ReadKey(true);

                // Backspace Should Not Work
                if (key.Key != ConsoleKey.Backspace && key.Key != ConsoleKey.Enter)
                {
                    pass += key.KeyChar;
                    Console.Write("*");
                }
                else if (key.Key == ConsoleKey.Backspace) 
                {
                    if (pass.Length > 0)
                        pass = pass.Substring(0, pass.Length - 1);
                    Console.Write("\b \b");
                }
            }            
            // Stops Receving Keys Once Enter is Pressed
            while (key.Key != ConsoleKey.Enter); 
            Console.WriteLine();
            return pass.TrimEnd('\r', '\n'); 
        }

The case of the missing ‘Process’ Performance counter

I recently had the need to do some monitoring of the Explorer.exe process (like one of the Windows 10 Insider Preview bugs) that every so often went bananas (Minions would like it…) for no reason at all. This is a pain if you have other processes on the same machine that is sensitive to things like running in ‘low’ priority (Like Boinc workloads). This effectively block other processes to run or just plain make the whole machine feel slow and sluggish.

Then I discovered the problem that perfmon could not ‘see’ the ‘Process’ category. This is weird since I  thought this would be one of the most basic performance counters that Windows always had and probably still have. Somehow the ‘Process’ category disappeared or became corrupted or something – I thought.

Anyway, after some digging around (aka Google) I found an old article about similar issues people had with older versions of Windows (even server versions). The culprit (at least in this case) was that for some reason the registry key to enable the ‘Process’ category was disabled. I have no idea how that happen (no I deny any involvement whatsoever… 🙂 ).

To fix do this: (standard registry editing disclaimer: do it at your own risk).

  1. Open Regedit
  2. Find the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\PerfProc\Performance
  3. Check the value of ‘Disable Performance Counters’. If it is anything but 0 it means it is disabled.
  4. Change the value to 0 and save.
  5. Restart whatever performance counter monitoring tool you are using since it will not be aware of the change until that process restart.
  6. Jump up and down for joy! (just because you can).

 

Visual Studio 2013 and 2015 icons

Thanks to VS2015 that happen to have the same icon as VS2013 it can be confusing if you have both installed (side-by-side). So as a simple solution I created my own customized icons based on the standard VS icon that also display the version (shortened). I’m simply sharing it here for other if they like to re-use it.

VS201x

Simply extract somewhere on your local HDD and then customize (create shortcut/pin to taskbar and then properties, Change Icon, browse and select the icon) and whoala!.

Sharing is caring… so they say.

Windows 10 upgrade survival guide

So I’ve been through the process to upgrade 3 machines (2 laptops and one desktop so far) to Windows 10 with a 33% success rate… yeah, I know that does not sound that promising. The other 66% I managed to fix with ‘resets’ which is basically a fresh install. In the end that comes to (technically) 99%. There are a few things that isn’t 100%… (small) things that are still causing some headaches – this guide is not about them.

So I decided to create this post to help others with the process. This will not be a all-out guide to upgrading because I’m sure I didn’t experience ALL the troubles you can have while upgrading to Windows 10.

Before the install

First tip I have is to rather use the Windows 10 Media creation tool to download the full ISO ( https://www.microsoft.com/en-us/software-download/windows10 ). The reasons for this are simply because then you have control over the download and if that fails the actual upgrade process does not fail at the same time. Secondly, you can then use the same ISO image to upgrade multiple machines without having to download the same ‘stuff’ multiple times.

Second tip is to prepare your machine for the upgrade by backing up (always a good idea) and cleaning any unused stuff – like uninstall applications which you really don’t use anymore as all applications whether you use it or not has to go through the upgrade process (be part of it) and can increase the duration time of the upgrade. The same applies to any unused hardware and drivers. Just get rid of them before you start. Unplug any external USB flash/hard drives. The Windows 10 upgrade process also checks for compatibility in case you missed something that is not compatible. Also, save of make a copy (or even a screenshot) of any saved passwords (e.g. those that are stored in your browser).

Thirdly it is useful to have a backup of all your drivers (yes, even those that you don’t even have the original disk for anymore!). I use a simple too like DriverBackup! ( http://sourceforge.net/projects/drvback/ ) but you can use any similar tool. In some cases Windows 8.x drivers should be compatible with Windows 10 (but don’t quote me on that). If for some reason Windows 10 did not recognize your hardware after the upgrade you can try to point device manager’s check for updated drivers to this driver backup directory.

4th’ly check for any outstanding Windows updates (yes the upgrade tool can also do this but it is better that you do this manually and you get to choose what/when/how this gets installed).

Lastly uninstall your anti-virus software (yes, that thing that hogs your machine worse than a virus itself). Some (possibly all) anti-virus software have been known to cause problems while doing Windows upgrades. You can re-install your anti-virus software after the upgrade if it is supported (might need to be upgraded to a Windows 10 compatible version in any case).

The Install

All of this and you haven’t even started the upgrade yet! phew… hehe

To start the upgrade process you can either create a DVD from the ISO using you favorite DVD burning tool (even Windows explorer in Windows 7 have an option to burn to DVD) or you can use a tool to open the ISO like a zip file (e.g. 7-zip which is free – http://www.7-zip.org/ ) and extract all the files somewhere on your hard drive. Once this is done simply run the Setup.exe in the root directory of this DVD/extracted directory. At this stage choose the option NOT to ‘also download updates’ (since you already did that during tip number 4).

The rest of the install process is mostly automated – with multiple reboots… crashes… bluescreens… just joking. If it does crash it should roll back and restore the previous version of Windows (this I’ve experienced a few times with the Insider previews so it does work). Just sit back and relax… right…

Post installation

Post the installation you are given some options to choose privacy options. For my taste I choose to disable most of them (like the typing and advertising settings which are enabled by default). Also, the Wireless Sense stuff I also disable (old habits of not trusting others…). When prompted for default apps you can choose to customize and then un-tick the ones presented as replacements. In my opinion the default should be to keep you existing default apps (like browser, music player etc) and have the new Microsoft alternatives as suggestions – not forced down you computing throat.

Wrap up

Ok, so once the setup/installation part is done and you are back at your desktop there are a couple of things to check and make sure all is happy in Windows 10 land. One of the first things I always check after such an upgrade is that all hardware (drivers) are properly installed. You can check this (in Windows 10) by right clicking on the new Start button (yes right-click on the start button actually does something useful – if you come from Windows 7 world) and choose ‘Device Manager’. Check for any yellow/red warning triangles (usually it should be very obvious as the tree nodes will be expanded by default showing the problem components). At this stage you can right click of the problematic component/tree node and choose ‘Update Driver Software’.

Try the online search option first as that ‘should’ get the latest available driver if any exists (and the device has been recognized). If it doesn’t work to ‘fix’ the device then try the same procedure again but this time choose the ‘Browse my computer…’ option and specify the driver backup directory as created in tip no. 3. (or if you happen to have the original disk that came with the device… what?? anyone keep those disks?? hehe). If this does not work try searching the manufacturer’s web site for updated drivers. Chances are that they won’t have Windows 10 drivers yet as it takes time to create and certify those drivers. In some cases Windows 8.1 drives ‘may’ work but… don’t quote me on that either. If all of this does not work then.. it just wasn’t meant to be… for now 🙂

Troubleshooting (Update)

If for some reason after this upgrade you experience problems like hardware devices bot working (even if drivers are installed and seems to be ok) or you get Blue screens of death (yes, they’re still blue) you can try to do a Windows ‘Reset’. This is rather destructive as far as your applications goes but at least your ‘Data’ files stay in tack.

If you can get into Windows (in case you don’t have Blue screen of death on login) you can go to Settings -> Recovery and Choose the ‘Reset this PC’ option. Choose to keep your files… unless you don’t want them anymore…

Alternatively if for some reason can can’t do this from within Windows itself make/obtain a bootable image (DVD or of your machine supports it – USB) and boot up from it. After selecting the languages and stuff on the first screen you will see a ‘Repair’ option on the second screen you get. From there you can select ‘Troubleshooting’ (or something like that since I don’t have that screen open now) and then ‘Reset this PC’. Remember to choose ‘Keep my files’. After that it will start (re)installing just like a full installation, multiple reboots etc. and eventually back at the login screen. At that point you’ll have a fairly ‘blank’ Windows installation with nothing but the default Windows applications installed. Your files will still be there but any applications you use that didn’t came with Windows itself will need to be reinstalled. Sometimes this actually might be a good thing to get rid of all the crap one has installed over the years…

Conclusion

All-in-all I think Windows 10 does have more positives than (drumroll) negatives. There are things I really don’t like about it but then there are some I do (like). Once you get it up and running it does seem to be worth the trouble. Happy Windows 10ing… (but I will miss my Windows 7)

VirtualBox 5 released

Just a heads-up. Oracle’s VirtualBox 5.0 has been released.

Head over to https://www.virtualbox.org/ and grab it while it’s still hot.