Category Archives: MS Windows

Notes about various technical issues of supporting and administering Windows Servers.

DBGWPROC.DLL on Windows 2008 R2 (Windows 7 x64)

We have a custom built client/server application developed in VisualBasic 6. VB 6 is unsupported development/deployment environment since March 2005. Recently, I stumbled on a bug with library DBGWPROC.DLL while trying to install client part of application on Windows 7 x64 (as far as I can tell, this error is related to x64 version of Windows 7/2008R2). Here is a recipe which I used to overcome the installation error:

  1. Author released the library to public domain, so get the newest release from here, more precisely from here.
  2. unzip library to C:\Windows\SysWOW64
  3. execute library registration at command line:
    cmd> cd C:\Windows\SysWOW64
    cmd> regsvr32 DbgWproc.dll
    

    If you’re doing registration on Windows 2008 R2 SP1 registration should succeed without the error, if you’re doing registration on Windows 7 x64 SP1, you’ll likely receive an error but you can ignore it (at least in my case everything worked as expected afterwards.Your millage can vary!)!

  4. install your application that is using DBGWPROC.DLL from your msi, when you receive error regarding DBGWPROC.DLL, simply ignore it.
  5. Test the application. Mine worked as if it was installed on Windows XP.

How to get SID with PowerShell

Here is simple example of how to retrieve local NT account (user or group) SID with powershell:

PS E:\TEST> $objUser = New-Object System.Security.Principal.NTAccount("alesk")
PS E:\TEST> $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
PS E:\TEST> $strSID.Value
S-1-5-21-1384281309-654973799-88281384-1000

To retrieve SID of domain user:

PS E:\TEST> $objUser = New-Object System.Security.Principal.NTAccount("acmedomain\alesk")
or
PS E:\TEST> $objUser = New-Object System.Security.Principal.NTAccount("acmedomain","alesk")

PS E:\TEST> $strSID = $objUser.Translate([System.Security.Principal.SecurityIdentifier])
PS E:\TEST> $strSID.Value
S-1-5-21-2377153150-1065022559-2428809875-3485

I found this tip among tips published on MS Technet Windows PowerShell tips.

How to convert dynamic disk to basic

Here is a short memo of how you can convert dynamic disk to basic from command line:

cmd> diskpart

DISKPART> list disk

DISKPART> select disk 0

DISKPART> detail disk

-- ------------------------------------------
-- note volume numbers on selected disk
-- and then delete all volumes from the disk
-- ------------------------------------------

DISKPART> select volume 3
DISKPART> delete volume

DISKPART> select volume 4
DISKPART> delete volume 

...
...

DISKPART> select volume 5  <-- last volume on disk 0
DISKPART> delete volume

-- ------------------------------------------
-- now, you can convert dynamic disk to basic
-- ------------------------------------------

DISKPART> select disk 0
DISKPART> convert basic

Replacement for net send (msg.exe)

This is a reminder on how can we send messages to Windows7/2008 after Microsoft deprecated net send mechanism.
Here I want to send message from my Windows XP SP3 workstation to Windows 7 SP1 machine. I’ll be using with msg.exe, the replacement for net send.

E:\>msg /?
Send a message to a user.

MSG {username | sessionname | sessionid | @filename | *}
    [/SERVER:servername] [/TIME:seconds] [/V] [/W] [message]

  username            Identifies the specified username.
  sessionname         The name of the session.
  sessionid           The ID of the session.
  @filename           Identifies a file containing a list of usernames,
                      sessionnames, and sessionids to send the message to.
  *                   Send message to all sessions on specified server.
  /SERVER:servername  server to contact (default is current).
  /TIME:seconds       Time delay to wait for receiver to acknowledge msg.
  /V                  Display information about actions being performed.
  /W                  Wait for response from user, useful with /V.
  message             Message to send.  If none specified, prompts for it
                      or reads from stdin.

My first attempt failed with error:

This was executed on my XP workstation trying 
to send message to "me" logged on mywindows7 PC:
E:\>msg alesk /server:mywindows7  "I need some coffee!!"
Error opening Terminal server kavsek7
Error [1717]:The interface is unknown.

The solution is to allow remote RPC execution on MYWINDOWS7 machine. On MYWINDOWS7 I opened Registry editor and changed AllowRemoteRPC from 0 to 1:

HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server
Name : AllowRemoteRPC
Type : REG_DWORD
Value : 1

Of course, it’s completely up to you to decide if you can live with open RPC port.

Nano on Windows x86/x64

My favorite port of OpenSSH for Windows OS is CopSSH, basically I’m running CopSSH more or less on every production Windows server. One bugger so far was the lack of decent terminal editor that would work out of the box after CopSSH installation. Recently, I started to consolidate different versions of CopSSH (the oldest being 1.4.6) and was happy when I discovered that my favorite editor on Linux, nano 2.2.6, works fine under cygwin environment that ships with the latest CopSSH 4.0.2. All that you need to do is to:

  • download and install CopSSh from Copssh_4.0.2_Installer.zip
  • download and install Control Panel update from ICW_COPSSHCP_2.0.3_installer.zip
  • download nano-2.2.6.zip
  • copy nano.exe from nano-2.2.6.zip archive to CopSSH bin directory, for example copying nano.exe from my local machine to Windows x64 server with scp:

  • scp nano.exe alesk@winbox:"/cygdrive/c/Program\ Files\ \(x86\)/CopSSH/bin"

    That’s it. You can now edit text files without the need to bypass (with WinSCP for example) ssh terminal session just for the sake of editing some configuration file.

Nano doesn’t work with older releases of cygwin that ships with CopSSH (for example on 1.4.6) due to the version mismatch of cygwin1.dll library. I didn’t bother to look for a workaround, since my objective is to deploy the latest version of CopSSH anyhow.