Add new virtualportgroup to vSwitch on multiple VMHosts with Powercli

If you dont have dvSwitches (Distributed vSwitches) in your vSphere cluster, or dont even have a cluster, you may have to add new portgroups manually, depending on the number of VMHosts this can be a pretty cumbersome task.

Luckily, we can use powercli to automate the task. In the following example i will use the -location parameter to define my tagets in the variable $hosts

Lets go ahead and define the VMhosts we want to target:

$hosts=get-vmhost -location “location”

Then, we create the new portgroup for every VMhost in the location by using a foreach loop:

foreach ($vmhost in $hosts) {Get-VMHost $vmhost | Get-VirtualSwitch -name “vSwitch0” | New-VirtualPortGroup -VLanId “10” -Name “Name”}

This will create a new VirtualPortGroup with VLAN ID 10 named “Name” on vSwitch0 on all the VMHosts in the specified location.

Remove the port again by doing this:

foreach ($vmhost in $hosts) {Get-VMHost $vmhost | Get-VirtualSwitch -name “vSwitch0” | Get-VirtualPortGroup -Name “Name” | Remove-VirtualPortGroup -Confirm:$false}

Remember that -Confirm:$false will remove the port without confirmation! Make sure you have the right targets in the $hosts variable!!!

Saving and restoring ESXi configuration, and fixing VMKCore coredump partition dump issues

Hi all.
Today i had to reinstall some ESXi 5.5 hosts as we were upgrading to SSD disks, in order to have more performance on the Citrix environment we are hosting.

Before i powered off the server, i saved the configuration to use for easy reconfiguration with the following command from powercli:

Get-VMHostFirmware -VMHost xxx-hostname-xxx -BackupConfiguration -DestinationPath C:\HostBackups\

Now i got a xxx.tgz file containing the full configuration of the original ESXi host, ready for importing back when the reinstall is done.

When the server was installed on the new disks, i connected directly to the reinstalled server by its IP address,  put the server in maintenance mode and imported the configuration backup with these commands from powercli:

Set-VMHost -State Maintenance

 

Set-VMHostFirmware -VMHost xxx-hostname-xxx -Restore -SourcePath c:\HostBackups\xxx.tgz -HostUser user -HostPassword password

Because of the new disks i got an error regarding my vmkcore vmkdumpfile that was missing. I was able to list the partition table, which showed that i had two different dump partitions, but none of them were configured for use.
To get it fixed i had to unconfigure the existing coredump partition with this command from the ESXi shell:

esxcli system coredump partition set -u

And then reconfigure the partition with this command, also from the ESXi shell:

esxcli system coredump partition set –enable true –smart

This command will let the system choose which partition to use for the coredumps. The system will now use the choosen partition, no reboot needed.

Re-Volt, Wine, Multiplayer

My kids are beginning to play on their computers, and when one of them where invited to a socalled LAN-Party it woke up memories in my mind. I remembered how I used to play at LAN parties my self, and I remembered how simple it was to set up a game and play against each others. Todays gaming is all about joining public servers, creating accounts, and answering questions about this and that.

That made me think back on one of my favourite games from around 2000, Re-Volt. I searched the web and found that Re-Volt isn’t dead at all, fan communities are still alive, and theres even a small patch for the latest version that will support modern wide screens, easier multiplayer, etc. Check it out here: http://www.revoltrace.net/ where you will also be able to download the latest version and patch.

The kids are running Windows 7 and Windows 10 and we had no issues installing it, the installer will ask for the directplay module and download it when needed. In order to play multiplayer we had to allow some firewall ports to be used even though the firewall is disabled on the local network. When hosting a game I noticed that it’s using my public IP and not my private, thats probably why I had to allow additional ports to be used – 🙁

Now, lets get back to the actual point for my post. I am running Ubuntu Linux 14.04 on my laptop, and I thought I would be able to play Re-Volt using Wine. No problem at all, it installed just fine and worked like a charm, until I wanted to play multiplayer over the LAN. I got different erros depending if I wanted to host or join a game, but quickly I found out that on Linux I also needed the so-called directplay module, which is easily installed with winetricks that comes with the Wine installation on my system. After some googling I found out that all I needed to do was:

winetricks directplay

This command will install the directplay module and now the game is running smoothly with or without multiplayer. Wine documentation states to run “sh winetricks directplay” which will not work for the package-manager installed version.

Using Vim as editor in PowerShell

If you are used to using Vim or Vi as your editor, you might miss it when using powershell. Good news is, theres a way to get it. Download and install Vim for windows, create a profile.ps1 file in this path: (for me at least) c:\users\%username%\documents\WindowsPowerShell\ and type in the following:

$VIMPATH    = “C:\Program Files (x86)\Vim\vim74\vim.exe”

Set-Alias vi   $VIMPATH
Set-Alias vim  $VIMPATH

# for editing your PowerShell profile
Function Edit-Profile
{
vim $profile
}

# for editing your Vim settings
Function Edit-Vimrc
{
vim $home\_vimrc
}

Remember to change the $VIMPATH to your installation.

Now you have a fully functional vim from powershell.

/Kasper

Team Fortress 2 on Steam in 64 bit systems

Hi all.

I just tried to install Team Fortress 2 in Steam on my Ubuntu 15.04 64bit system, and I got this error message:

You are missing the following 32-bit libraries, and Steam may not run: libc.so.6

I asked google, and I found an article suggesting to do this: apt-get install lib6* – this will install a hell of a lot of software that you probably don’t need.

So instead of just following the suggestion I did an apt-search libc6, and found this package: libc6-i386, I installed it, and now I was able to install Team Fortress 2 in steam.

/Kasper

Forbinde til en VM i KVM med virsh console

En nem mĂ„de at forbinde til en KVM VM er ved brug af kommandoen virsh console ‘vm-name’. Man forbinder direkte til konsollen, og pĂ„ den mĂ„de er man uafhĂŠngig af netvĂŠrk. Mon ikke de fleste har prĂžvet at rive sig selv i hĂ„ret, nĂ„r man opdager at man har lukket sig selv ude fra SSH.

NĂ„r man fĂžrst er inde skal man jo ogsĂ„ ud igen, hvis man er vant til at arbejde med SSH skriver man naturligt exit nĂ„r man vil ud, men sĂ„ ender man bare i login prompten, stadig pĂ„ den samme maskine. NĂ„r man logger ind kommer et fint lille hint der fortĂŠller at “Escape character is ^]”, og hvad betyder sĂ„ det? Jo, det mĂ„ vĂŠre noget med “Ctrl+AltGr+9”, jeg kan afslĂžre med det samme at det virker ikke. PĂ„ min maskine med dansk tastatur layout er det “Ctrl+5”, det er jo dejligt nemt, nĂ„r man fĂžrst har brugt Âœ-1 time pĂ„ at finde ud af det 🙂

Alt i alt en nem og hurtig mÄde at logge ind pÄ de enkelte virtuelle maskine og mÄske endnu vigtigere en god backup, hvis man har dummet sig med netvÊrket.

Cyanogenmod MMS, data og telenor

Jeg har nu efterhÄnden, ad flere omgange kÞrt med Cyanogenmods ROM pÄ min telefon i ret lang tid. Et af de problemer, jeg oftest er stÞt pÄ ved skiftet, er understÞttelsen af MMS, det har altid drillet.

Der findes en funktion der kan nulstille APN’erne, den sĂžger pĂ„ netvĂŠrket og finder ud af hvad man skal bruge, problemet er bare at de ikke virker. PĂ„ min telefon ender jeg op med APN’er til Belmore og Bibob begge med internet og MMS. LĂžsningen har for mig tidligere vĂŠret at fjerne Bibob APN’erne og sĂ„ har det virket.

Nu begyndte den sĂ„ at drille igen forleden, fejlen viste sig ved at jeg igen ikke kunne sende MMS’er. Jeg tjekkede hurtigt APN’erne, men det var kun Telenors der var tilstede. Jeg brugte nulstillingsfunktionen og nu havde jeg igen bĂ„de bibog og Telenor APN’er, jeg slettede dem til Bibob, men nu virkede hverken MMS’er eller dataforbindelse (3G) 🙁

Efter at have opgivet i den tro at det var 3G dÊkningen der var for dÄrlig i det sommerhusomrÄde jeg befandt mig, kunne jeg konstatere ved hjemkomst at jeg stadig havde problemer.

Jeg tjekkede Telenors hjemmeside for at finde de korrekte oplysninger, og jeg fandt en guide der beskrev de oplysninger der skal til. Jeg tjekkede i forhold til de oplysninger den henter fra netvĂŠrket og bemĂŠrkede at der pĂ„ min telefon er en sĂ„kaldt MVNO-type og en MVNO-vĂŠrdi hvor der i begge stod TELMORE bĂ„de under internet og MMS’s opsĂŠtningen. Jeg prĂžvede lykken og slettede TELMORE alle 4 steder, og indenfor 1 sekund var jeg tilbage pĂ„ 3G nettet og MMS’erne tikkede ind.

APN ConfigurationAPN Overview

Installer MPEG-2 licens pÄ Raspberry Pi

Raspberry Pi er lavet med henblik pĂ„ at den skal kunne kĂžbes af alle, derfor er der sparet alle steder hvor det er muligt. En af de steder der er sparet er i CPU’ens mulighed for at decode visse codecs, istedet for bare at ligge en licens ind fra starten, der ville forhĂžje prisen for alle, har man valgt en model hvor man selv kĂžber en licens, hvis man vil bruge raspberry pi som mediecenter og har brug forat afspille disse codecs.

For mit vedkommende gÊlder det primÊrt de optagelser jeg laver med min mythtv server, de ligger tit i MPEG-2 format og dem kan jeg sÄ ikke uden videre afspille pÄ min OpenElec installation pÄ raspberry pi.

LĂžsningen er at kĂžbe en licens her: http://www.raspberrypi.com/mpeg-2-license-key/

Omregnet koster den ca. 25 dkr, det er lige til at overkomme, men hvordan fÄr man den sÄ installeret?

Inden man bestiller skal man lige hav fundet serienummeret pÄ sin CPU, det gÞres sÄledes:

SSH til din raspberry pi. PÄ en Openelec er std. kodeord openelec, og brugernavnet er root. Fra windows kan man bruge Putty, pÄ Linux kan man bruge terminalen og skriv:

ssh -l root ip-adresse-pÄ-raspberry-pi

NĂ„r man er logget ind kĂžrer man kommandoen:

cat /proc/cpuinfo

Det ser sÄdan her ud:

root@stuen’s password:
##############################################
# OpenELEC – The living room PC for everyone #
# …… visit http://www.openelec.tv …… #
##############################################

OpenELEC (official) Version: 4.0.6
Stuen:~ # cat /proc/cpuinfo
processor    : 0
model name    : ARMv6-compatible processor rev 7 (v6l)
Features    : swp half thumb fastmult vfp edsp java tls
CPU implementer    : 0x41
CPU architecture: 7
CPU variant    : 0x0
CPU part    : 0xb76
CPU revision    : 7

Hardware    : BCM2708
Revision    : 000f
Serial        : 0000000002529fb3
Stuen:~ #

Min raspberry hedder Stuen, bare for at undgĂ„ misforsatĂ„elser 🙂

NÄr man har fÄet fat i serienummeret kan man bestille sin licens.

Efter et par dage dumper der en mail ind, med en specifik genereret kode der passer til din raspberry pi, nu skal den sÄ installeres, det gÞres som fÞlger:

Log ind pĂ„ din raspberry med ssh igen, i mappen /flash skal der vĂŠre en config.txt fil, mĂ„ske findes den allerede, ellers skal den laves. Men inden vi gĂžr noget skal vi lige sikre os at vi kan skrive i /flash mappen, den er nemlig mounted “read only”, vi remounter den lige med “read write”. GĂžr dette fra root folderen (cd /)

mount /flash -o remount,rw

Nu kan vi skrive i mappen og enten editere den fil der allerede ligger der, eller lave en ny. Filen skal indeholde en linie med “decode_MPG2=den-kode-du-fiki-din-mail”

vi /flash config.txt

tryk pĂ„ “i” for at skrive i filen

tryk :wq for at gemme (kolon efterfulgt af w og q write/quit)

Vi er en editor der kan virke lidt besvÊrlig til at begynde med, men lÊr dig selv de mest basale kommandoer, den findes stort set pÄ alle Unix/Linux systemer

NĂ„r du har gemt filen skriver du reboot i konsollen, systemet genstarter og du kan nu se MPEG2 filer 🙂