Disclaimer: All postings are provided "AS IS" with no warranties, and confer no rights. This weblog does not represent the thoughts, intentions, plans or strategies of Microsoft. Because a weblog is intended to provide a semi-permanent point-in-time snapshot, you should not consider out of date posts to reflect current thoughts and opinions.
UPDATED: 8/6/2008 - Minor issue on Path
I've built quite a few WSS / MOSS machines and one task that I always seem to do is create a simple CMD shell prompt on the desktop (quick launch, etc.) that gives me easy access to STSADM and has the path set correctly. So in the interest of saving time I've created a simple VBScript file located here as well as the full listing below
Set Shell = CreateObject("WScript.Shell") Set Env = Shell.Environment("PROCESS") DesktopPath = Shell.SpecialFolders("Desktop") Set link = Shell.CreateShortcut(DesktopPath & "\WSS CMD.lnk") cssHive = Env("CommonProgramFiles") & "\Microsoft Shared\web server extensions\12" currentPath = RTrim(Replace(WScript.ScriptFullName, WScript.ScriptName, "")) envBatFile = "setWssPath.cmd" CreateBatFile currentPath & setWssPath & envBatFile, cssHive link.Arguments = "/k " & " " & Chr(34) & currentPath & envBatFile & Chr(34) link.Description = "WSS Command Prompt" link.HotKey = "CTRL+SHIFT+W" link.IconLocation = "%SystemRoot%\system32\SHELL32.dll,94" link.TargetPath = "%comspec%" link.WindowStyle = 1 link.WorkingDirectory = cssHive link.Save Sub CreateBatFile(fileName, cssHive) Set fso = CreateObject("Scripting.FileSystemObject") Set file = fso.CreateTextFile(fileName, True) file.WriteLine("@SET PATH=%PATH%;" & cssHive & "\bin") file.WriteLine("@ECHO WSS CMD Shell - Shawn Cicoria") End Sub
Set Shell = CreateObject("WScript.Shell") Set Env = Shell.Environment("PROCESS") DesktopPath = Shell.SpecialFolders("Desktop") Set link = Shell.CreateShortcut(DesktopPath & "\WSS CMD.lnk")
cssHive = Env("CommonProgramFiles") & "\Microsoft Shared\web server extensions\12" currentPath = RTrim(Replace(WScript.ScriptFullName, WScript.ScriptName, "")) envBatFile = "setWssPath.cmd"
CreateBatFile currentPath & setWssPath & envBatFile, cssHive
link.Arguments = "/k " & " " & Chr(34) & currentPath & envBatFile & Chr(34) link.Description = "WSS Command Prompt" link.HotKey = "CTRL+SHIFT+W" link.IconLocation = "%SystemRoot%\system32\SHELL32.dll,94" link.TargetPath = "%comspec%" link.WindowStyle = 1 link.WorkingDirectory = cssHive link.Save
Sub CreateBatFile(fileName, cssHive) Set fso = CreateObject("Scripting.FileSystemObject") Set file = fso.CreateTextFile(fileName, True) file.WriteLine("@SET PATH=%PATH%;" & cssHive & "\bin") file.WriteLine("@ECHO WSS CMD Shell - Shawn Cicoria")
End Sub
Recently, I messed up a set of VHD files that were based upon differencing disks. Basically, I killed the parent drive - so, any child drives are useless.
So, how do you know which drives are differencing disks and what is their parent?
One way is through the COM interfaces (that call into an out-of-process server). Virtual Server must be installed and the service running for these interfaces to work.
However, on an X64 machine you won't be able, in Visual Studio 2005 or Visual Studio 2008 see the Typelib registered via the Add Reference -> COM tab. Why? Because Visual Studio is 32 bit and the COM registration on x64 machines is not visible via the WOW64 Registry redirection.
So, a simple fix is to create (copy) the same sub key for win32. A merge of the following will then allow you to set a reference and call into the interfaces
Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\TypeLib\{D7526A6D-CF83-48A4-87FD-4FBE2AEC5D93}\1.1\0\win32] @="C:\\Program Files\\Microsoft Virtual Server\\vssrvc.exe"
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\TypeLib\{D7526A6D-CF83-48A4-87FD-4FBE2AEC5D93}\1.1\0\win32] @="C:\\Program Files\\Microsoft Virtual Server\\vssrvc.exe"
What you then need to do is ensure you follow the steps in the MSDN article below to ensure proper COM initialization and setting of the apartment model to MTA instead of STA which is the default attribute applied via the VS templates.
Connecting to the Virtual Server COM Object