Blog go bye-bye?

May 8, 2008 – 4:53 pm

Well, it was bound to happen eventually.  Something was going to happen to cause my blog to go offline.   I thought I would loose interest, but far from it.  Im now blogging on technet so ultimatly this site is not going to be updated that frequently, if at all.  Pop over and have a look.

Scripting: How to edit an INI file from a script

April 30, 2008 – 1:54 pm

I was asked how to modify an INI from a script.  Its quite straight forward.  Firstly have a read of the Scripting Guy article here.  It explains the process quite well actually.  However, I wanted to go a step further and setup arguments to make the script re-useable.  So here is the modified script:

‘Usage: modini.vbs <full path to ini>, Parameter to change, New Value
‘Example: modini.vbs c:\folder\my.ini, Script, change

Const ForReading = 1
Const ForWriting = 2

strINIFile = WScript.Arguments.Item(0)
strParam = WScript.Arguments.Item(1)
strValue = WScript.Arguments.Item(2)

If WScript.Arguments.Count <> 3 Then WScript.Quit

Set objFSO = CreateObject(”Scripting.FileSystemObject”)
Set objTextFile = objFSO.OpenTextFile(strINIFile, ForReading)

Do Until objTextFile.AtEndOfStream
    strNextLine = objTextFile.Readline

    intLineFinder = InStr(strNextLine, strParam)
    If intLineFinder <> 0 Then
        strNextLine = strParam & “=” & strValue
    End If

    strNewFile = strNewFile & strNextLine & vbCrLf
Loop

objTextFile.Close

Set objTextFile = objFSO.OpenTextFile(strINIFile, ForWriting)

objTextFile.WriteLine strNewFile
objTextFile.Close

Here is a sample batch file calling the VBS script:

cscript //nologo modini.vbs “c:\my.ini” “Blog” “sometimes”

And thats it!  Short and sweet.

Batch Files : Date Stamp in a filename

April 18, 2008 – 2:20 pm

Ive been asked this a number of times this past month.  How do I get the date into a filename in a batch file?

Most peope try using the %date% variable.  Which will not work as you cannot have /’s in the filename.

So, try this:

for /f “tokens=1-4 delims=/ ” %%i in (”%date%”) do set datestring=%%i%%j%%k

You can now use %datestring%.txt as the filename

Note: Florian from Germany points out that the delim character changes depending on your locale.  Eg. deliims=. for Germany.  They also point out that you may want to change the filename to %%k%%j%%i to get multiple logs sorted in order within Windows Explorer sorted by YearMonthDate
 
 

 

Hyper-V: Migrating my Virtual PC and Virtual Server VMs

April 18, 2008 – 2:17 pm

While you cannot import your VMs from Virtual Server or Virtual PC you can still attach the VHDs to new or existing VMs in Hyper-V.  However, there are a few things you should do BEFORE you mount them in Hyper-V.

  • Uninstall any Virtual Machine components
  • I also recommend sysprep’ing the VM before you boot it in Hyper-V.  You wont run into any issues with the HAL needing to be updated due to the change in Virtual Hardware.
  • If the VM is not Windows Server 2008 or Windows Vista you more than likely wont have any mouse until you install the Hyper-V Integrated Services.
  • If your VM is Windows Server 2003 make sure its running SP2 before you bring it into Hyper-V see http://mcshera.com/?p=5 for more details.

Other than the points above its a straight forward process and works quite well.

Wordpress ate my site

April 6, 2008 – 9:39 pm

Well, not really.  Upgraded to Wordpress 2.5 this evening.  Quite an involved job.  Download the ZIP file, extract it, backedup my config files and uploaded the new version.  Took ages to do .. about 5 minutes.  Happy days.

Living in a Virtual World: Domain Controllers and Time Synchronisation

April 6, 2008 – 9:04 pm

The question of how to handle Domain Controllers has been around for quite some time.  The answer really depends on what product you have decided to use as your virtualisation platform.  Personally I have found both Microsoft Virtual Server and VMWare ESX pretty good solutions to my virtual requirements.  Regardless of the product you have choosen, you will still have to make the same decision when it comes to Domain Controllers: How will I handle Time Synchronisation?  Its at this point that the Microsoft and VMWare approaches differ.  Before I go into the details there is one thing that both companies agree on.  Do not let your VMs use more than one method for Time Sync as this could lead to numerous time changes … and you most definatly do not want this happening on Domain Controllers. 

Side Note: Its worth noting that the challenge of Time Sync in a Virtual environment is not a bug or an issue related to how either vendor approaches virtualisation.  The problem is due to the hardware virtualisation, more specially the virtual CPU.  The phyiscal CPU’s cycles help keep the time in sync just like a clock mechanisim.  When the hardware is virtual, you no longer have the physical cycles to stop the time drifting. 

 Right, so how do the two approaches differ?  Well, keeping in mind that both agree you should only use one method for time sync here are the two approaches:

  • Microsoft:  DISABLE the “Virtual Machine Additions” ability to sync time with the host.  Use the normal domain hierarchy for Domain Controllers with the exception of the PDC in the forest root.  Configre the PDC to use an external NTP source
  • VMWare: ENABLE the “VMWare Tools” Time Synchronisation with the host.  Disable the normal domain hierarchy for Domain Controllers.  Additionally, installed the NTP Daemon on the ESX host and have it sync with an external NTP source. 

Microsoft do not recommend sync’ing with the physical host whereas VMWare recommend you do.  So, from a supportability stance, which option do you choose?  Good question!  No surprises, but I would recommend starting with the Microsoft approach regardless of whether you are using ESX or not.  Why?  Well, from a support perspective following the VMWare approach means that you have to  stop time sync from working as it should in a normal Active Directory Domain.  If you run into problems and try and open a support case, you are putting yourself at a distinct disadvantage.

From experience, the busier the phyiscal host, i.e. your Virtual Server 2005 or ESX box, the more likely you are to have time sync issues as the virtual cpu cycles can a little bit “wonky”.  If you are running a test/lab environment I wouldn’t be too worried.  If you are running Domain Controllers in a product environment, well, keep a very close eye on things.

To recap: If Im running VMs on Virtual Server 2005 (or Hyper-V) I will always follow the Microsoft recommendations.  If Im running on an ESX box, I’ll still start with the Microsoft approach but if I still had issues, then the prudent thing would be to follow the VMWare recommendations and hope that someone can provide you with support.

References:

Considerations when hosting Active Directory domain controller in virtual hosting environments 

Support policy for Microsoft software running in non-Microsoft hardware virtualization software

Apple: Kettle calling pot black - Safari bundled with iTunes

March 30, 2008 – 1:03 am

Apple bundling Safari with iTunes 

When you download Apples iTunes it comes with the Apple “Updater”.  Ive put the key word in quotes.  Yup, UPDATER.  I wanted iTunes, I dont want Safari (Apples Browser).  It’s a strange move for Apple, especially when I cast my mind back to the first antitrust cases against Microsoft for the bundling of Internet Explorer with Windows operating systems.  Back then, and still today, the arguement is about allowing customers to have a choice.  I decided to download and install iTunes.  I want to know about “Updates” for iTunes.  Since I did not decide to download Safari, I dont want to be constantly reminded about Safari … especially when its pitched as an update.  I wonder how many people downloaded and installed Safair without knowing what it actually does.

What surprises me more is the number of posts that suggest its okay for Apple to distribute their browser as an “update” mainly because people see it as a great way to sock it to Microsoft.  I’m wondering if there are two sets of rules out there.  One for Microsoft and one for everyone else.  You can’t complain about the lack of choice for consumers and then disguise one product as an update for another.  Apples distribution is not the same as Windows update.  Windows update points out that there are optional installations available … it doesnt push a new product as an update for another.  And to me, this is the simple issue.  Apple could surely present Safari as an option, or a new product via Apple Update.  Don’t try and slide it onto an Windows OS and set it as the default browser. 

A good bulk of users out there dont know any better and simply click OK, I Agree, Yes and Conitinue without ever knowing what the hell has just happened … is that the way Apple wants to pitch its products?  Surely they should be pushing them by merit and how “cool” the product is .. after all, its what makes Apple so different from everything else out there.

Windows Server 2008 - Hyper-V Release Candidate: How to upgrade beta

March 20, 2008 – 1:49 pm

Microsoft have just made the first releae candidate available for their Virtualisation plaform, namely Hyper-V.  Details of the release can be found here.  You can download the update here.

Unfortunatly there is no direct upgrade path from the Beta version.  This means that you will have to recreate your VM’s.  Its not as bad as you think.  Your disks (VHDs) will still work … you just have to recreate your VMs in Hyper-V and point to your disks.  One thing to note though, I reckon your snapshots might not work … but Ive yet to test that.

To upgrade try the following:

  1. Shutdown all VMs gracefully.
  2. Remove the Hyper-V role from your Windows Server 2008 x64.
  3. Reboot
  4. Install the update
  5. Add the Role back again
  6. Re-create your VMs and point them at your original VHDs.

All going well the upgrade from RC to RTM should be a simple process.

Windows 2000 Terminal Server : Modify RDP-tcp permissions via script

March 19, 2008 – 12:55 pm

I was recently asked how to modify the rdp permissions on a large number of Windows 2000 SP4 servers running in Remote Admin mode.  Well, normally Id make use of WMI and make the changes using Win32_TSPermissionsSetting class.  Unfortunatly this class is not available in Windows 2000. 

To get around this issue in Windows 2000 try the following:

  1. Create a domain group and manually assign the permissions to the RDP-Tcp connection on a single server
  2. Export the following reg key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\Security (REG_BINARY)
  3. You can now import this reg key on any number of servers across your enterprise.  Since the change was not made using the API you may have to reboot the server

Expensive Hypervisors - a bad idea even if you can afford them

March 13, 2008 – 6:25 pm

Here is a great post from James O’Neill. 

 http://blogs.technet.com/jamesone/archive/2008/03/13/expensive-hypervisors-a-bad-idea-even-if-you-can-afford-them.asp

As Microsoft get ready with Hyper-V VMware are beginingg their marketing blitz in an attempt to justify their pricing.  As James points out in his post you can manipulate figures to come to any conclusion you want … even if its way off base.  Microsofts Hyper-V will cost a fraction, per socket, when compared to VMWare.  While the VMWare products are slightly more mature Hyper-V is only a small part of the Virtualisation offering from Microsoft.  Windows Server 2008 really brings Mircosoft virtual offerings to the forefront as an end-to-end solution.  Check out http://www.microsoft.com/virtualization/default.mspx for more details.