PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Forums Hébergement > Forum Hébergement serveur > ms..win.server.scripting > Renaming of mapped network drive lost after end of script
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Renaming of mapped network drive lost after end of script

Réponse
 
LinkBack Outils de la discussion
Vieux 27/09/2007, 15h42   #1 (permalink)
scOOBay
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Renaming of mapped network drive lost after end of script

Hi All,

I got a problem with some of my workstations to rename mapped network
drives.

I do rename the network drives using vbscript:

objShell.NameSpace(sDrive & "\").Self.Name = sCustomName

My Problem is that the new name is only available when the script is
running.
I put a simple MsgBox at the end of the script. Then I can see the new
name in the
windows explorer until I press OK on the MsgBox.

Can anyone me regarding this problem?

Thanks a lot!

Regards

Thomas

  Réponse avec citation
Vieux 02/10/2007, 16h55   #2 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: Renaming of mapped network drive lost after end of script

This works on my network, of course here i use a server/share but i map to AD
namespaces, which works as well

Option Explicit
Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName, strMachineName
Dim strUserName, objUserName
'
on error resume next

' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
Set objShell = CreateObject("Shell.Application")
Set objUserName = CreateObject("WScript.Shell")

' Add Share
strDriveLetter = "O:"
strRemotePath = "\\server\share"
strNewName = "APPS" ' Any alias you decide
objNetwork.RemoveNetworkDrive strDriveLetter
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath
objShell.NameSpace(strDriveLetter).Self.Name = strNewName

"scOOBay" wrote:

> Hi All,
>
> I got a problem with some of my workstations to rename mapped network
> drives.
>
> I do rename the network drives using vbscript:
>
> objShell.NameSpace(sDrive & "\").Self.Name = sCustomName
>
> My Problem is that the new name is only available when the script is
> running.
> I put a simple MsgBox at the end of the script. Then I can see the new
> name in the
> windows explorer until I press OK on the MsgBox.
>
> Can anyone me regarding this problem?
>
> Thanks a lot!
>
> Regards
>
> Thomas
>
>

  Réponse avec citation
Vieux 02/10/2007, 17h00   #3 (permalink)
Jeff
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut RE: Renaming of mapped network drive lost after end of script

if your "sDrive" is in the form of "D:" then you shouldn't need the & "/"
with it. Just leave it as "sDrive" and see if it s. The script in my
other post works quite well for me, I use it on close to 800 systems.
"scOOBay" wrote:

> Hi All,
>
> I got a problem with some of my workstations to rename mapped network
> drives.
>
> I do rename the network drives using vbscript:
>
> objShell.NameSpace(sDrive & "\").Self.Name = sCustomName
>
> My Problem is that the new name is only available when the script is
> running.
> I put a simple MsgBox at the end of the script. Then I can see the new
> name in the
> windows explorer until I press OK on the MsgBox.
>
> Can anyone me regarding this problem?
>
> Thanks a lot!
>
> Regards
>
> Thomas
>
>

  Réponse avec citation
Vieux 08/10/2007, 09h32   #4 (permalink)
stefaan.van.grunderbeek@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Renaming of mapped network drive lost after end of script

On 27 sep, 16:42, scOOBay <scOO...@gmail.com> wrote:
> Hi All,
>
> I got a problem with some of my workstations to rename mapped network
> drives.
>
> I do rename the network drives using vbscript:
>
> objShell.NameSpace(sDrive & "\").Self.Name = sCustomName
>
> My Problem is that the new name is only available when the script is
> running.
> I put a simple MsgBox at the end of the script. Then I can see the new
> name in the
> windows explorer until I press OK on the MsgBox.
>
> Can anyone me regarding this problem?
>
> Thanks a lot!
>
> Regards
>
> Thomas


I have exactly the same problem! Immedialely after the script ran, the
drives are renemed back to their original names.

Here's the script (ignore the echo's, it's just for debugging ..)
----------------------------------------------------------------------------------------------------------------------
Option Explicit

Dim objNetwork, objShell, coldrives, i

Set objNetwork = CreateObject("Wscript.Network")
Set objShell = CreateObject("Shell.Application")
Set colDrives = objNetwork.EnumNetworkDrives

On error resume next

wscript.echo "Renaming network drives ..."

For i = 0 to colDrives.Count-1 Step 2
Select Case colDrives.item(i)
Case "Y:"
wscript.echo "Y:"
objShell.NameSpace(colDrives.item(i)).Self.Name = "ServerFolders"
Case "O:"
wscript.echo "O:"
objShell.NameSpace(colDrives.item(i)).Self.Name = "Outlook
Persoonlijke Mappen"
Case "H:"
wscript.echo "H:"
objShell.NameSpace(colDrives.item(i)).Self.Name = "Persoonlijke
Documenten"
Case "R:"
wscript.echo "R:"
objShell.NameSpace(colDrives.item(i)).Self.Name = "Dynaview
Verbinding"
End Select
Next

If err.number <> 0 then
wscript.echo err.description
End if
------------------------------------------------------------------------------------------------------

  Réponse avec citation
Vieux 08/10/2007, 13h20   #5 (permalink)
stefaan.van.grunderbeek@gmail.com
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Renaming of mapped network drive lost after end of script

On 8 okt, 10:32, stefaan.van.grunderb...@gmail.com wrote:
> On 27 sep, 16:42, scOOBay <scOO...@gmail.com> wrote:
>
>
>
>
>
> > Hi All,

>
> > I got a problem with some of my workstations to rename mapped network
> > drives.

>
> > I do rename the network drives using vbscript:

>
> >objShell.NameSpace(sDrive & "\").Self.Name = sCustomName

>
> > My Problem is that the new name is only available when the script is
> > running.
> > I put a simple MsgBox at the end of the script. Then I can see the new
> > name in the
> > windows explorer until I press OK on the MsgBox.

>
> > Can anyone me regarding this problem?

>
> > Thanks a lot!

>
> > Regards

>
> > Thomas

>
> I have exactly the same problem! Immedialely after the script ran, the
> drives are renemed back to their original names.
>
> Here's the script (ignore the echo's, it's just for debugging ..)
> ----------------------------------------------------------------------------------------------------------------------
> Option Explicit
>
> Dim objNetwork, objShell, coldrives, i
>
> Set objNetwork = CreateObject("Wscript.Network")
> Set objShell = CreateObject("Shell.Application")
> Set colDrives = objNetwork.EnumNetworkDrives
>
> On error resume next
>
> wscript.echo "Renaming network drives ..."
>
> For i = 0 to colDrives.Count-1 Step 2
> Select Case colDrives.item(i)
> Case "Y:"
> wscript.echo "Y:"
> objShell.NameSpace(colDrives.item(i)).Self.Name = "ServerFolders"
> Case "O:"
> wscript.echo "O:"
> objShell.NameSpace(colDrives.item(i)).Self.Name = "Outlook
> Persoonlijke Mappen"
> Case "H:"
> wscript.echo "H:"
> objShell.NameSpace(colDrives.item(i)).Self.Name = "Persoonlijke
> Documenten"
> Case "R:"
> wscript.echo "R:"
> objShell.NameSpace(colDrives.item(i)).Self.Name = "Dynaview
> Verbinding"
> End Select
> Next
>
> If err.number <> 0 then
> wscript.echo err.description
> End if
> ------------------------------------------------------------------------------------------------------- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -


after some more testing, I found out the following:

- the script actually works. It's just that after the script ends, the
old names come back. Putting a wscript.sleep 30000 keeps the correct
drivenames for 30 secs.
- my workstation seems to be the only workstation that doesn't have
this problem, all (200) others do...
- I tried with local admin credentials, without any change

the updated testing script:

'This script will rename network drives to something more fool-proof
'Drive Y will be named 'ServerFolders'
'Drive O will be named 'Outlook Data Files'
'Drive H will be named 'Persoonlijke Documenten'
'Note: this should run after network drives have been mapped ...

Option Explicit

Dim objNetwork, objShell, coldrives, i

Set objNetwork = CreateObject("Wscript.Network")
Set objShell = CreateObject("Shell.Application")
Set colDrives = objNetwork.EnumNetworkDrives

On error resume next

wscript.echo "Renaming network drives ..."

For i = 0 to colDrives.Count-1 Step 2
Select Case colDrives.item(i)

Case "Y:"
wscript.echo "old name Y: " &
objShell.NameSpace(colDrives.item(i)).Self.Name
objShell.NameSpace(colDrives.item(i)).Self.Name = "ServerFolders"
wscript.echo "new name for Y :" &
objShell.NameSpace(colDrives.item(i)).Self.Name

Case "O:"
wscript.echo "old name O :" &
objShell.NameSpace(colDrives.item(i)).Self.Name
objShell.NameSpace(colDrives.item(i)).Self.Name = "Outlook
Persoonlijke Mappen"
wscript.echo "new name for O :" &
objShell.NameSpace(colDrives.item(i)).Self.Name


Case "H:"
wscript.echo "old name H :" &
objShell.NameSpace(colDrives.item(i)).Self.Name
objShell.NameSpace(colDrives.item(i)).Self.Name = "Persoonlijke
Documenten"
wscript.echo "new name for H :" &
objShell.NameSpace(colDrives.item(i)).Self.Name


Case "R:"
wscript.echo "old name R: " &
objShell.NameSpace(colDrives.item(i)).Self.Name
objShell.NameSpace(colDrives.item(i)).Self.Name = "Dynaview
Verbinding"
wscript.echo "new name for R: " &
objShell.NameSpace(colDrives.item(i)).Self.Name
End Select

Next

wscript.sleep 20000

If err.number <> 0 then
wscript.echo err.description
End if


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 01h45.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13106 seconds with 13 queries