Windows 2008 R2 on VMWare: “Unable to contact IP driver. General failure”


I have cloned (Deployed) new image from a template in VMWare of Windows Server 2008 R2 server. And joined to a domain (and domain controller is another VM deployed from same template). Then this frigging error message creped up in Command Prompt whenever I try any network commands (ping, ipconfig, etc.,): “Unable to contact IP driver. General failure”

After spent few minutes on Bing, I found the solution myself. It’s frigging duplicate SID. Usually duplicate SID is not an issue (according to Microsoft). But in my case, the domain controller and standalone server has same SID (deployed from same VM image template).  My solution is to run SysPrep to generate a new SID and it’s resolved the issue for me.

  1. Open Command Prompt in elevated mode (right click and select “Run as Administrator”)
  2. Change your path to C:\Windows\System32\SysPrep
  3. Type SysPrep and select the defaults.
  4. Reboot the VM and re-join to the domain.

There. If that resolved your issue, leave me a comment. Smile

Windows 7: Auto Login to Domain Account and lock the desktop right away


I saw this blog post in Life Hacker (Make Windows load your desktop before you log in) and see the interesting idea which I used to do few years ago. That Life hacker post is for home users. It doesn’t apply to the domain computers, obviously. So I decided to explain how to auto logon with Domain account and lock your desktop on start up. Here it is.

  1. Open Registry Editor (Start Orb –> type Regedit.exe)
  2. Browse to this location: HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindows NTCurrentVersionWinlogon
  3. Edit DefaultUserName key and type your domain user name
  4. If doesn’t exist, Create DefaultDomainName (string or REG_SZ) key and edit it with your domain name
  5. If doesn’t exist, create DefaultPassword (string or REG_SZ) key and edit it with your password
  6. If doesn’t exist, create AutoAdminLogon (string or REG_SZ) key and edit with “1”.
  7. Close Registry Editor
  8. Open Notepad
  9. Type this: WScript.CreateObject("WScript.Shell").Run("rundll32 user32.dll,LockWorkStation")
  10. Save it as “LockDesktop.vbs” (NOTE: you have to type script name in double quotes, or it will save it with “.txt” in the end) to a known location (would say Documentsscripts in your profile)
  11. Click Start –> All Programs. Right click on Startup and select Open.
  12. On Startup Folder, right click on empty space and select New –> Shortcut.
  13. Select your script (LockDesktop.vbs) on your saved location and create a shortcut.
  14. That’s it. Reboot your computer and watch your computer auto login with your account and locks the desktop right away.

Make sure have a plan to change the password when your password expires in the registry (DefaultPassword key). I would create a local user account and have it handy just in case. Enjoy!

ADLDS aka ADAM Sync: Ldap error occured. ldap_add_sW: Attribute Or Value Exists


Here in my company we sync Active Directory to ADLDS and ADAM servers using ADAMSync. One day the sync was broken with the following error message. When I first saw the following error in ADAM sync log, it took a while to realize what happened in Active Directory to cause break the ADAM sync.

Extended Info: 0000217B: AtrErr: DSID-03050758, #1:
0: 0000217B: DSID-03050758, problem 1006 (ATT_OR_VALUE_EXISTS), data 0, Att 90290 (userPrincipalName)
.
Ldap error occured. ldap_add_sW: Attribute Or Value Exists.
Extended Info: 0000217B: AtrErr: DSID-03050758, #1:
            0: 0000217B: DSID-03050758, problem 1006 (ATT_OR_VALUE_EXISTS), data 0, Att 90290 (userPrincipalName)

Obviously if you read carefully, sync was broken because of userPrincipalName mismatch between ADLDS and Active Directory. Our help desk created a new user account, then realized the name was wrong and corrected it later. ADAM sync was happened between wrong UPN and modified correct UPN. Now ADLDS holds the unmodified UPN and it sees new UPN for the user and sync quits.

Solution to my problem: Correct the UPN for the user in ADLDS user ADSIEdit (match it exact in Active Directory). Start the ADAMSync and it will sync correctly. Sometimes you may have to fix multiple users’ UPNs. If you have multiple UPNs, check all of them with source and target.

Windows Server 2008 VM: Hiberfil.sys is filling up Disk Space


This blog post is only valid for “Windows Server 2008” Release 1.

If you run Windows Server 2008 server in VM environment, you should know the following things.

  1. Hibernation feature is ENABLED by default in Windows Server 2008
  2. There are no GUI settings to turn hibernation off
  3. “hiberfil.sys” takes as much as your memory size, sitting in C: and wasting precious disk space in VM

I found out little lately that my Windows Server VMs were running out disk space and took a while to figure out what’s happening.

Solution:

You can disable the hibernation feature by command line tools. There is two step process:

1. Open command prompt in elevated mode (right click on Command prompt icon and select “Run as Administrator”). Type the following command to disable the hibernation feature.

powercfg.exe /hibernate off

2. Access your servers C: root directory from different computer (\Servernamec$) and delete “Hiberfil.sys” file. (if you try to delete this file locally on the server, you are in big surprise)

Hey best thing about this solution is NO REBOOT required. 🙂

A cluster node is not available for this operation. Error ID: 5005 (0000138d)


I was trying to move a cluster group to other node,  I couldn’t move the group at all and what’s up with this error:

A cluster node is not available for this operation.
Error ID: 5005 (0000138d)

After a little research, I found one of the resource properties “possible owners” were not listed all cluster nodes. I guess at one point my colleagues were trying to bind a cluster group only to one node and they don’t want to move this cluster node to other node accidentally. 

Solution: Go through each cluster resource properties and check “possible owners” listed correctly.

More Information: http://support.microsoft.com/kb/263317

Fixing Dead XenApp Servers automatically by script


My Citrix XenApp farm runs with XenApp 5 on Windows Server 2008 64bit servers. I found a strange issue on few XenApp Servers goes to Zombie mode. The server is pingable and operational. No users connected to this server. If you have specific application points to this server, Users get this error message:

It was not possible to launch the selected application.
Please contact your administrator
The Citrix client reported error: 12

If you run “QFarm /Load” on any one of the XenApp server in the farm, load results doesn’t list the zombie server.  ‘”Change Logon /Query” command result shows Logon is enabled. I read the available hot fixes and none of them fixes this issue.  smile_baringteeth

Easy fix is to restart “Citrix Independent Management architecture” aka IMA service on the problematic server. By restarting IMA service you are re-registering the server to the Farm. The load balancing algorithm starts accounting the server after IMA restart.

So I wrote the following script and run it by hour using Windows Scheduler on one of the XenApp server. This script sends emails details report to specified admins when it fixes the zombie server issue. Till I find a permanent fix from Citrix or Microsoft, This script is saving me from aches.

If you want to use this script, copy and paste this script to Notepad.  Look for “<<<< Modify the value here..” and change the appropriate values according to your company. Schedule it on one of your XenApp servers.

'======================================================================
' Name:      Fix-XenApp-Servers.vbs
' Purpose:   Detect if XenApp server is dropped from Load Balancing.
'            If Yes, Restart the Citrix IMA server and send email alert.
' Parameters: None
' Written By: Anand Venkatachalapathy
' Date Written: Feb 10th 2010
'====================================================================== 
 
Const IMAService = "Citrix Independent Management Architecture"
Dim WshShell, WshExec
Dim LoadData, emailSubject,emailTo,i
Public emailBody
Dim XenAppServers
 
XenAppServers = Array("CitrixSvr1","CitrixSvr2","CitrixSvr3")  '<<<<<<<<< Modify the value here
 
emailTo = "admin1@company.com;admin2@company.com"     '<<<<<<<<< Modify the value here
Set WshShell = WScript.CreateObject("WScript.Shell")
 
'Run qfarm /load command and get the results to LoadData variable
Set WshExec = WshShell.Exec("qfarm /load ") 
LoadData = LCase(WshExec.StdOut.ReadAll)
 
For i = 0 To UBound(XenAppServers)
    
    'Check if XENAPPxx server is missing
    If InStr(LoadData,LCase(XenAppServers(i))) = 0 Then
        WScript.Echo XenAppServers(i) & " is not responding"
        emailSubject = XenAppServers(i) & " was not responding, IMA service restarted"
        emailBody = XenAppServers(i) & " Server was not listed in QFarm /Load command as below" & vbCrLf
        emailBody = emailBody & LoadData & vbCrLf & vbCrLf & _
"Trying to fix by restarting IMA service to re-register to the farm" & vbCrLf & vbCrLf
        
        'Restart Citrix IMA service
        service_control XenAppServers(i),IMAService,"restart"
        
        Set WshExec = WshShell.Exec("qfarm /load ") 
        LoadData = LCase(WshExec.StdOut.ReadAll)
        
        emailBody = emailBody & "QFarm /Load results after IMA service restart" & vbCrLf
        emailBody = emailBody & LoadData
        emailBody = emailBody & vbCrLf & vbCrLf & "--------Written By: Anand Venkatachalapathy------------"
            
        'Send email to Citrix Admins
        Alert_Admins emailTo,emailSubject,emailBody
    End If
 
Next
 
'*** End of Script ***
 
 
 
 
 
 
'==============================================================================
' Name:      Service_Control
' Purpose:   Restart, Stop or Start a Service on a remote server 
' Input:     strComputer - Remote Server Name
'             sname - Service Display Name
'             purpose - has to be "stop" or "start" or "restart"
'==============================================================================
Sub Service_Control(strComputer,sname,purpose)
    'strComputer is the computer you want to connect to
    'sname is the service name
    'purpose is whether or not you want to start, stop or restart a service
    Dim delay, err_return
    delay = 20000    '20 seconds
    WScript.stdout.Write "*"
    Set objWMIService = GetObject("winmgmts:" _
        & "{impersonationLevel=impersonate}!\" & strComputer & "rootcimv2")
    Set colListOfServices = objWMIService.ExecQuery _
            ("Select * from Win32_Service where DisplayName = '" & sname & "'")
    For Each objService In colListOfServices
        'Just to double check we have the right service
        If objService.displayname = sname Then
            WScript.stdout.Write "*"
            If purpose = "stop" Or purpose = "restart" Then
                    emailBody = emailBody & "Trying to stop " & strComputer & "" & objService.name & vbCrLf
                    err_return = objService.stopservice
                    'service has dependencies, so we need to stop those first
                    If err_return = 3 Then
                        'GOTCHA - you have to use the service.name NOT service.displayname for this query!!
                        'even if you change Win32_Service.Name to Win32_Service.DisplayName
                        Set colServiceList2 = objWMIService.ExecQuery("Associators of " _
                           & "{Win32_Service.Name='" & objService.name & "'} Where " _
                                & "AssocClass=Win32_DependentService " & "Role=Antecedent" )
                        For Each objService2 in colServiceList2
                            emailBody = emailBody & "Trying to stop " & strComputer & "" & objService2.name & vbCrLf
                            objService2.StopService()
                            If Not objService2.state = "Stopped" Then
                                'you have to pause because the service wont start unless it is completely stopped
                                WScript.Sleep delay
                                service_control strComputer,sname,"stop"
                            Else
                                'WScript.Echo objService2.displayname & " has been stopped."
                                emailBody = emailBody & strComputer & "" & objService2.name & "has been stopped." & vbCrLf
                            End If
                        Next
                        'stop the original service that had dependencies
                        emailBody = emailBody & "Trying to stop " & strComputer & "" & objService.name & vbCrLf
                        objService.stopservice
                    Else
                        If Not objService.state = "Stopped" Then
                            'you have to pause because the service wont start unless it is completely stopped
                            WScript.Sleep delay
                            service_control strComputer,sname,"stop"
                        Else
                            'WScript.Echo objService.displayname & " has been stopped."
                            emailBody = emailBody & strComputer & "" & objService.displayname & " has been stopped." & vbCrLf & vbCrLf
                        End If
                    End If
                    'if restart was sent, start service after it has stopped
                    If purpose = "restart" Then service_control strComputer, sname, "start" End if
            Elseif purpose = "start" Then    
                    WScript.stdout.Write "*"
                    emailBody = emailBody & "Trying to start " & strComputer & "" & objService.name & vbCrLf
                    err_return = objService.startservice
                    If NOT err_return = 10 Then
                        'GOTCHA - you have to use the service.name NOT service.displayname for this query!!
                        'even if you change Win32_Service.Name to Win32_Service.DisplayName
                        Set colServiceList2 = objWMIService.ExecQuery("Associators of " _
                           & "{Win32_Service.Name='" & objService.name & "'} Where " _
                                & "AssocClass=Win32_DependentService " & "Role=Antecedent" )
                        For Each objService2 in colServiceList2
                            emailBody = emailBody & "Trying to start " & strComputer & "" & objService2.name & vbCrLf
                            objService2.StartService()
                            If Not objService2.state = "Running" Then
                                'you have to pause because the service wont start unless it is completely stopped
                                WScript.Sleep delay
                                service_control strComputer,sname,"start"
                            Else
                                WScript.Echo objService2.displayname & " has been started."
                                emailBody = emailBody & strComputer & "" & objService2.displayname & " has been started" & vbCrLf
                            End If
                        Next
                        
                        emailBody = emailBody & "Trying to start " &  strComputer & "" & objService.name & vbCrLf
                        err_return = objService.startservice
                        'service has dependencies, so we need to start those first
                        If err_return = 3 Then
                            'start the original service that had dependencies
                            emailBody = emailBody & "Trying to start " &  strComputer & "" & objService.name & vbCrLf
                            objService.startservice
                            'End If
                            If Not objService.state = "Running" then
                                'you have to pause because the service wont start unless it is completely stopped
                                WScript.Sleep delay
                                service_control strComputer,sname,"start"
                            Else
                                'WScript.Echo objService.displayname & " has been started."
                                emailBody = emailBody &  strComputer & "" & objService.displayname & " has been started." & vbCrLf
                            End If
                        End If
                    End If
                    'WScript.Echo objService.displayname & " has been started."
                    emailBody = emailBody &  strComputer & "" & objService.displayname & " has been started" & vbCrLf
            End If
        End If
    Next
 
End Sub 
'*** End of service_control sub ***
 
 
 
 
 
 
 
'======================================================================
' Name:      Alert_Admins
' Purpose:   Sends email 
' Input:     strTo - Who to send to, strSub - Subject of the message
'             strBody - Body of the message
' Output:    Sends the emails to the strTO recipients
'======================================================================
Sub Alert_Admins( strTo,strSub,strBody)
 
    'WScript.Echo strBody
 
    '* iMsg - holds CDO.Message object
    '* Flds - Enumeration for CDO SMTP object properties 
    '* iConf - holds CDO.Configuration
    Dim iMsg, Flds, iConf
 
    '* sSMTPServerName - SMTP Server Name
    Dim sSMTpServerName
 
    '* Assign corpml servers as SMTP server
    sSMTPServerName = "smtp.company.com"   '<<<<<<<<< Modify the value here
 
    '* Assign cdoSendUsingPort is set to 2, i.e., send using SMTP (25) port
    Const cdoSendUsingPort = 2
 
    '* Create CDO Objects and assign to variables
    Set iMsg = CreateObject("CDO.Message")
    Set iConf = CreateObject("CDO.Configuration")
    Set Flds = iConf.Fields
 
    '* Assign values to Flds class properties
 
    With Flds
        .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sSMTPServerName
        .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 25  
        .Update
    End With
 
    '* Assign message properties and Send the mail
    With iMsg
        Set .Configuration = iConf
        .Fields("urn:schemas:httpmail:importance").Value = 2    'Setting Mail importance to High (2)
        .Fields.Update
        .To = strTo
 
        'Fake, but make-sense email FROM address
        .From = "XenApp-Fixer@company.com"               '<<<<<<<<< Modify the value here
 
        'Return Email address
        .Sender = "XenApp-Fixer@company.com"            '<<<<<<<<< Modify the value here
        .Subject = strSub
        .TextBody = strBody
    .Send
    End With
 
End Sub
'*** End of Alert_Admins Sub ***

XenApp: “This file does not have a program associated with it for performing this action” when try opening Picture Files


If you happen to run XenApp 5 on Windows Server 2008 platform and users can’t open Picture files on a Citrix session, you are having the headache once I had. Let me describe the problem.

Users are trying to open up an Picture file attachment on a Citrix Session (from the published application like Outlook, SAP, etc.,). They get the following or similar error message. If User has Administrative privileges, Picture file opens up with Office Picture Manager if installed, otherwise given a dialog box to select a program to open with.

image

What’s wrong with Windows Server 2008? It has no default picture viewer. Office Picture Manager (if installed) does not associate picture files for ALL USERS, so it will not work for Users on a Citrix session.

Solution:

1. Install “Desktop Experience” feature in Windows Server 2008 server. (I didn’t choose this solution, because I don’t want to add extra desktop features which my users aren’t going to use it).

    • Log on to XenApp server with Administrative privileges
    • Open “Server Manager” console
    • Select “Features” section and click on “Add features” link.
    • Click Next and select the checkbox “Desktop Experience”. Click Install.
    • After the Install, verify the picture files are associated with default Windows picture viewer.

image

2. Install a third-party picture viewer (like IrfanView, FastStone Image Viewer, Picture Viewer). Better yet, find a portable version of these software and download it to the servers. Associate the picture files for ALL USERS using the software options/preferences. I am personally using IrfanView portable version, it works great on Citrix XenApp servers.

Hope it helps you.

Keywords: XenApp 5, Windows Server 2008, Picture files,JPG, BMP, JPEG,TIFF,association