Monday, August 30, 2010

Adding a Network Location to Win7 Libraries

I was trying to deal with migrating two separate organizations where one org was redirecting My Documents to the network while the other org didn't and didn't want to.  I came to the solution on Windows 7 by using Libraries.  I needed to add the user's %homeshare% to the Documents Library.  This brought up a number of issues including adding a network location without it being indexed.  I figured out that I could create a symbolic link locally, pointing to the network location in Win7 and then add the symbolic link to Library.  I also needed to do this for all of the W7 users and that meant it needed to be automated.

Using ShLib.exe from:
http://www.grimadmin.com/article.php/creating-modifying-windows-7-libraries

Here's the script:
set media=%~dp0
@echo off

echo Creating the folder to hold the Symbolic Link
md "%userprofile%\Libraries"

echo Creating the Symbolic Link
mklink /D "%userprofile%\Libraries\Network_Home" "%homeshare%"

echo Add the Symbolic Link to the Documents Library
%media%shlib add "%userprofile%\AppData\Roaming\Microsoft\Windows\Libraries\Documents.library-ms" "%userprofile%\Libraries\Network_Home"

echo Set the Symbolic Link as the default save location
%media%shlib setsaveloc "%userprofile%\AppData\Roaming\Microsoft\Windows\Libraries\Documents.library-ms" "%homeshare%"


After automating it the next issue was how to get around the UAC elevate prompt so users didn't have to "approve" the change.  I was able to add the script and supporting files into SCCM as a Package and referenced the script as the Program.

The Advertisement was then setup with the following:
Advertised to All Clients
Limited to Windows 7 x64 and Windows 7 x86 (it might run on Vista, but I don't have and Vista machines)
Set to Run only when a user is logged on
Set to Run once for every user (advanced tab)

It works great, the user never sees a prompt and we've got a great solution for the entire organization.

Wednesday, August 25, 2010

Win7 x64: 32bit Odbc vs 64bit Odbc

When configuring an Application to use a DSN via the ODBC Administrator it is important to understand if you need a x64 ODBC connection or a x86 ODBC connection.
It’s important to understand which kind of DSN you have. On an x64 system, you can create an ODBC connection(DSN) on the 32-bit side of the system or on the 64-bit side of the system. 32-bit applications will only see ODBC connections created in the 32-bit side, and 64-bits applications will only see ODBC connections from the 64-bit side. Each application has is own place in the registry.


To setup DSN for 32-bit application you must use:
%WINDIR%\SysWOW64\odbcad32.exe

and for 64-bit application you must use:
%WINDIR%\System32\odbcad32.exe (this is the one in the W7 control panel)

http://support.microsoft.com/kb/942976/en-us