[THIN] Re: Naming a subst'd drive

  • From: "Tom Howarth" <Tom.howarth@xxxxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Tue, 11 Dec 2007 15:36:37 -0000

That'll be your solution then ;)

 

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Andrew Wood
Sent: 11 December 2007 14:07
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Naming a subst'd drive

 

Tom,

 

As I explained while I was in the pub while waiting to go to see the new
Blade Runner last night and not in any way upset at not having got tickets
to go to the Led Zepplin gig at the o2 .. with the Citrix USB Utility you
can allow users 'dynamically' add USB drives 

 

What the utility does is use NTFS to link the contents of your usb drive to
a directory on your local machine - so when you plug in a drive you get a
directory e.g. c:\citrixusbstore\drive_e  which you can read/write too. 

 

This directory is visible via the client drive mapping - allowing you to
'dynamically' see add/removed drives from an ica session without having to
log off/on.

 

Now, I couldn't run the command net use m:  \\client\c$\clientdir
<file:///\\client\c$\clientdir>  - it would always fail - I get a 'the
specified network resource or device is no longer available'.  I wondered
last night if it was because the mapped directory was long (by default its
\\client\c$\clientdir\citrixusbstore
<file:///\\client\c$\clientdir\citrixusbstore> ) - but I've tested it again
this morning with '\\client\c$\temp' and it still doesn't work. I'd be
interested to know if others have the same problem or if its just something
quirky I've got on this environment. 

 

I could use:

 

net use m: \\client\c$ <file:///\\client\c$>  and then subst n:\
m:\citrixusbstore

 

or

 

subst n: \\client\c$\citrixusbstore <file:///\\client\c$\citrixusbstore> 

 

In both these instances the default label for the drive is 'disconnected
drive' - which isn't pretty. 

 

After the conversation last night I've looked at issuing a /persistent
command - that didn't work either L

 

You can rename the disconnected drive in explorer, but not (when I tested
last night) programmatically as the drive doesn't appear in
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2 until
*after* the logon scripts have finished for some reason :?

 

That said, I'd put the code in as part of the logon app compatibility
scripts,  when I run it there the mountpoints2 values don't appear to be
being created until the session had initialised.

 

However, if I put the following script in, say, the all users\Startup
directory it all works and gets renamed as expected:

 

on error resume next 

const HKEY_CURRENT_USER =  &H80000001

strClientDriveLetter = "N:"

Set oShell = CreateObject( "WScript.Shell" ) 

Set
oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:S
tdRegProv")

 

strKeyPath =
"Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2"

 

oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrSubKeys

nRet = oShell.Run ("cmd /c subst " & strClientDriveLetter & " /d",0,TRUE) 

nRet = oShell.Run ("cmd /c subst " & strClientDriveLetter & "
\\client\c$\citrixusbstore",0,TRUE)

oReg.EnumKey HKEY_CURRENT_USER, strKeyPath, arrnewSubKeys

lFound = false

for each  cNewsubkey In arrNewSubKeys

    if left(cNewsubkey,1) = "{" Then 

          lFound = false

        for each cOldsubkey in ArrSubkeys

           if cNewSubKey = cOldSubKey then

            lFound = true

           end if

        next 

 

        if not(lFound) then

          exit for 

        end if    

    end if

Next

 

if not lfound then

      oShell.RegWrite "HKCU\" & strKeyPath & "\" & cNewSubKey &
"\_LabelFromReg","My USB Store","REG_SZ"

end if

 

 

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Tom Howarth
Sent: 10 December 2007 19:52
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Naming a subst'd drive

 

Andrew why do you want to do this?

 

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Joe Shonk
Sent: 10 December 2007 17:43
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Re: Naming a subst'd drive

 

Net use m: \\client\c$\clientdir <file:///\\client\c$\clientdir>  doesn't
work for you?

 

Joe

 

From: thin-bounce@xxxxxxxxxxxxx [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf
Of Andrew Wood
Sent: Monday, December 10, 2007 10:25 AM
To: thin@xxxxxxxxxxxxx
Subject: [THIN] Naming a subst'd drive

 

Hi, 

I've got a W2k3 SP2 server and I want to create a subst mapping to a client
drive

So - net use M:  <file:///\\client\c$> \\client\c$ 

All, fine and dandy

Now I want to subst a drive to a directory on c:

Subst N: m:\clientdir

Hurrah - N: is subst'd

*But* in explorer it appears as 

I can manually rename the drive - which is fine for the session - but as the
subst isn't persistent it gets lost each time.

I've looked at manipulating the MountPoints2 reg key - but it's a different
key everytime, and only appears as a key once you do a rename.

 

I've looked at using shell.application.namespace method, but it only appears
to work for network drives.

L

Any ideas how to rename the drive so that instead of being 'disconnected' it
comes up as "user friendly drive name"?

Tia.

Andrew

Gilwood CS Ltd

Registered Office :  197 Leechmere Road, Sunderland, UK, SR2 9DL. No.
6099397 England

Other related posts: