Hallo NG,
wie kann ich im FSO den VolumeName ändern? Ich möchte per script
Netzlaufwerke verbinden und danach die Namen ändern, weil der Text so lang
ist (Freigabename auf Servername).

Danke für die Hilfe

Gruß Jörg

Hello NG,

how can i change with FSO the VolumeName?
Plz help.

Thx Jörg

Re: VolumeName by Joe

Joe
Thu May 01 05:11:37 CDT 2008

"Jörg Harnisch" <Harnisch@wbgwolfen.de> wrote in message
news:u8OHR61qIHA.5068@TK2MSFTNGP02.phx.gbl...
> Hallo NG,
> wie kann ich im FSO den VolumeName ändern? Ich möchte per script
> Netzlaufwerke verbinden und danach die Namen ändern, weil der Text so lang
> ist (Freigabename auf Servername).
>
> Danke für die Hilfe
>
> Gruß Jörg
>
> Hello NG,
>
> how can i change with FSO the VolumeName?
> Plz help.
>
> Thx Jörg
>
>
>
I've never tried this but according to the documentation the VolumeName of
the Drive object accessed via the FileSystemObject is read/write.

--

Joe Fawcett (MVP - XML)

http://joe.fawcett.name



Re: VolumeName by Alex

Alex
Thu May 01 07:00:07 CDT 2008

Jörg, could you explain what you mean by volume name? It can be interpreted
3 different ways.

(1) In WMI, a Win32_Volume's "name" is the drive _path_ : this is "C:\",
"D:\", and so on. You can't change the drive letter from script or a
readily-available commandline tool to the best of my knowledge, although
MSDN does have demo code for a tool that can do this:
http://msdn.microsoft.com/en-us/library/aa364014.aspx
Be careful with this; you can make a system unbootable if you modify the
boot or the system drive assignment!

(2) In mountvol, the VolumeName is a unique GUID (corresponding to
Win32_Volume's DeviceID, I believe). Sysinternals wrote a tool for changing
this for NTFS and FAT volumes:
http://technet.microsoft.com/en-us/sysinternals/bb897436.aspx

(3) What FSO calls a VolumeName is - as Joe Fawcett mentioned - the drive's
display _label_. You can actually modify this with the built-in label.exe
tool. It works fine from WSH or PowerShell as well.

Using VBScript:

Set fso = CreateObject("Scripting.FileSystemObject")
Set drives = fso.Drives
drives.Item("C:").VolumeName = "New Name"


Using PowerShell (shown since I tested it this way):

$fso = New-Object -Com Scripting.FileSystemObject
$dr = $fso.Drives
$dr.Item("C:").VolumeName = "test"


Note that whichever one you want to do, the current user/session needs
administrative privileges.


"Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
news:Oal$#O3qIHA.2256@TK2MSFTNGP05.phx.gbl...
> "Jörg Harnisch" <Harnisch@wbgwolfen.de> wrote in message
> news:u8OHR61qIHA.5068@TK2MSFTNGP02.phx.gbl...
>> Hallo NG,
>> wie kann ich im FSO den VolumeName ändern? Ich möchte per script
>> Netzlaufwerke verbinden und danach die Namen ändern, weil der Text so
>> lang ist (Freigabename auf Servername).
>>
>> Danke für die Hilfe
>>
>> Gruß Jörg
>>
>> Hello NG,
>>
>> how can i change with FSO the VolumeName?
>> Plz help.
>>
>> Thx Jörg
>>
>>
>>
> I've never tried this but according to the documentation the VolumeName of
> the Drive object accessed via the FileSystemObject is read/write.
>
> --
>
> Joe Fawcett (MVP - XML)
>
> http://joe.fawcett.name
>
>

Re: VolumeName by Jörg

Jörg
Thu May 01 09:01:44 CDT 2008

Hello an Thanks,
the VBScript is what i need.


"Alex K. Angelopoulos" <aka(at)mvps.org> schrieb im Newsbeitrag
news:O5u7pL4qIHA.3408@TK2MSFTNGP03.phx.gbl...
> Jörg, could you explain what you mean by volume name? It can be
> interpreted 3 different ways.
>
> (1) In WMI, a Win32_Volume's "name" is the drive _path_ : this is "C:\",
> "D:\", and so on. You can't change the drive letter from script or a
> readily-available commandline tool to the best of my knowledge, although
> MSDN does have demo code for a tool that can do this:
> http://msdn.microsoft.com/en-us/library/aa364014.aspx
> Be careful with this; you can make a system unbootable if you modify the
> boot or the system drive assignment!
>
> (2) In mountvol, the VolumeName is a unique GUID (corresponding to
> Win32_Volume's DeviceID, I believe). Sysinternals wrote a tool for
> changing this for NTFS and FAT volumes:
> http://technet.microsoft.com/en-us/sysinternals/bb897436.aspx
>
> (3) What FSO calls a VolumeName is - as Joe Fawcett mentioned - the
> drive's display _label_. You can actually modify this with the built-in
> label.exe tool. It works fine from WSH or PowerShell as well.
>
> Using VBScript:
>
> Set fso = CreateObject("Scripting.FileSystemObject")
> Set drives = fso.Drives
> drives.Item("C:").VolumeName = "New Name"
>
>
> Using PowerShell (shown since I tested it this way):
>
> $fso = New-Object -Com Scripting.FileSystemObject
> $dr = $fso.Drives
> $dr.Item("C:").VolumeName = "test"
>
>
> Note that whichever one you want to do, the current user/session needs
> administrative privileges.
>
>
> "Joe Fawcett" <joefawcett@newsgroup.nospam> wrote in message
> news:Oal$#O3qIHA.2256@TK2MSFTNGP05.phx.gbl...
>> "Jörg Harnisch" <Harnisch@wbgwolfen.de> wrote in message
>> news:u8OHR61qIHA.5068@TK2MSFTNGP02.phx.gbl...
>>> Hallo NG,
>>> wie kann ich im FSO den VolumeName ändern? Ich möchte per script
>>> Netzlaufwerke verbinden und danach die Namen ändern, weil der Text so
>>> lang ist (Freigabename auf Servername).
>>>
>>> Danke für die Hilfe
>>>
>>> Gruß Jörg
>>>
>>> Hello NG,
>>>
>>> how can i change with FSO the VolumeName?
>>> Plz help.
>>>
>>> Thx Jörg
>>>
>>>
>>>
>> I've never tried this but according to the documentation the VolumeName
>> of the Drive object accessed via the FileSystemObject is read/write.
>>
>> --
>>
>> Joe Fawcett (MVP - XML)
>>
>> http://joe.fawcett.name
>>
>>