change network share inside active citrix session and shared name

714 Views Asked by At

I need to change a mapped network drive inside a seamless citrix session. No big deal so far as I use PS3 to start programs:

$y = \\server\share1    
if(!(get-psdrive y)){
New-PSDrive -Name Y $y -Persist -PSProvider FileSystem
}
else{
    Get-PSDrive Y | Remove-PSDrive -Force
    New-PSDrive -Name Y $y -Persist -PSProvider FileSystem
}

The problem occurs after changing $y to another value (e.g. \server\share2) and remap the drive within an active seamless session. Within already started Citrix Seamless Apps the remapping is done, the drive shows the content of share2 but its name in explorer (e.g. file save as dialogue) is still \server\share1, which is confusing.

Is there a way to update also the name of the share inside already started seamless apps.

  • All actions / seamless app starts are done in the same ica session, of course.
  • XenApp 6

Thanks

1

There are 1 best solutions below

0
On BEST ANSWER

I managed it. I think it's an ugly solution, but it works for me. If someone has a better solution, please let me know.

Here's mine: Windows stores the name of each ever connected share in the registry at "hkcu:Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\"

If there is a Label defined that name is used. So just label each share. But be aware, if you have more than one network drive connected, all labels of all network drives will be changed!

$regkeypart1 = "hkcu:Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2\"
$regkeypart2 = "_LabelFromDesktopINI"
foreach( $currentItem in Get-ChildItem -Path $regkeypart1){
    set-itemproperty -Path $regkeycomplete -Name $regkeypart2 -Value "New Volume Display Label"
}

If you want to get rid of the labels, just delete or empty the "_LabelFromDesktopINI" for all shares in the registry.