Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Change share script

Reply
 
Old 05-18-2009   #1 (permalink)
Jon LaBarge


 
 

Change share script

Hello,

I am relatively new to scripting. In an effort to NOT wake up at 1:30 in the
morrning to migrate a share, does anyone know a vbscript to do that? Here's
what I have (all Win2003):

\\server1\oldshare is the old share. We've migrated the data in the share to
a SAN and now it's stored in \\server1\newshare

I want a script that will copy the NTFS permissions and then delete the
share to 'oldshare' while creating the share to 'newshare'

Anyone have a path for me to take here?

TIA!

Jon



My System SpecsSystem Spec
Old 05-18-2009   #2 (permalink)
Pegasus [MVP]


 
 

Re: Change share script


"Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
news:e8lG3x$1JHA.1712@xxxxxx
Quote:

> Hello,
>
> I am relatively new to scripting. In an effort to NOT wake up at 1:30 in
> the morrning to migrate a share, does anyone know a vbscript to do that?
> Here's what I have (all Win2003):
>
> \\server1\oldshare is the old share. We've migrated the data in the share
> to a SAN and now it's stored in \\server1\newshare
>
> I want a script that will copy the NTFS permissions and then delete the
> share to 'oldshare' while creating the share to 'newshare'
>
> Anyone have a path for me to take here?
>
> TIA!
>
> Jon
The following three commands will do the trick:
@echo off
net share oldshare /delete
net share newshare="d:\User Files\ShareName"
permcopy.exe {Technical Resource Kit}

I would actually use robocopy.exe to copy the files to the new destination -
it has a switch to copy NTFS permissions. You can do it with a VB Script too
but you will end up with a much more complex solution, which requires much
more testing and debugging.

However . . . If this is a production server and if people's ability to do
their job depends on the availability of the various shares then I would get
up at 1:30 am and supervise the delivery of this baby and test things in
full. Most of my clients would take a dim view of me having a undisturbed
rest while their system is falling to pieces. How tolerant is your
boss/client? How secure is your job? Anyone nipping at your heels?


My System SpecsSystem Spec
Old 05-18-2009   #3 (permalink)
Jon LaBarge


 
 

Re: Change share script

I forgot to mention that this also need to be a hidden share. Is there a
switch that I need to include?


"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:%23FlPe5$1JHA.4412@xxxxxx
Quote:

>
> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
> news:e8lG3x$1JHA.1712@xxxxxx
Quote:

>> Hello,
>>
>> I am relatively new to scripting. In an effort to NOT wake up at 1:30 in
>> the morrning to migrate a share, does anyone know a vbscript to do that?
>> Here's what I have (all Win2003):
>>
>> \\server1\oldshare is the old share. We've migrated the data in the share
>> to a SAN and now it's stored in \\server1\newshare
>>
>> I want a script that will copy the NTFS permissions and then delete the
>> share to 'oldshare' while creating the share to 'newshare'
>>
>> Anyone have a path for me to take here?
>>
>> TIA!
>>
>> Jon
>
> The following three commands will do the trick:
> @echo off
> net share oldshare /delete
> net share newshare="d:\User Files\ShareName"
> permcopy.exe {Technical Resource Kit}
>
> I would actually use robocopy.exe to copy the files to the new
> destination - it has a switch to copy NTFS permissions. You can do it with
> a VB Script too but you will end up with a much more complex solution,
> which requires much more testing and debugging.
>
> However . . . If this is a production server and if people's ability to do
> their job depends on the availability of the various shares then I would
> get up at 1:30 am and supervise the delivery of this baby and test things
> in full. Most of my clients would take a dim view of me having a
> undisturbed rest while their system is falling to pieces. How tolerant is
> your boss/client? How secure is your job? Anyone nipping at your heels?
>

My System SpecsSystem Spec
Old 05-18-2009   #4 (permalink)
Pegasus [MVP]


 
 

Re: Change share script

Share are hidden when they have a "$" at the end of their name.


"Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
news:%23ivCGDA2JHA.1420@xxxxxx
Quote:

>I forgot to mention that this also need to be a hidden share. Is there a
>switch that I need to include?
>
>
> "Pegasus [MVP]" <news@xxxxxx> wrote in message
> news:%23FlPe5$1JHA.4412@xxxxxx
Quote:

>>
>> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
>> news:e8lG3x$1JHA.1712@xxxxxx
Quote:

>>> Hello,
>>>
>>> I am relatively new to scripting. In an effort to NOT wake up at 1:30 in
>>> the morrning to migrate a share, does anyone know a vbscript to do that?
>>> Here's what I have (all Win2003):
>>>
>>> \\server1\oldshare is the old share. We've migrated the data in the
>>> share to a SAN and now it's stored in \\server1\newshare
>>>
>>> I want a script that will copy the NTFS permissions and then delete the
>>> share to 'oldshare' while creating the share to 'newshare'
>>>
>>> Anyone have a path for me to take here?
>>>
>>> TIA!
>>>
>>> Jon
>>
>> The following three commands will do the trick:
>> @echo off
>> net share oldshare /delete
>> net share newshare="d:\User Files\ShareName"
>> permcopy.exe {Technical Resource Kit}
>>
>> I would actually use robocopy.exe to copy the files to the new
>> destination - it has a switch to copy NTFS permissions. You can do it
>> with a VB Script too but you will end up with a much more complex
>> solution, which requires much more testing and debugging.
>>
>> However . . . If this is a production server and if people's ability to
>> do their job depends on the availability of the various shares then I
>> would get up at 1:30 am and supervise the delivery of this baby and test
>> things in full. Most of my clients would take a dim view of me having a
>> undisturbed rest while their system is falling to pieces. How tolerant is
>> your boss/client? How secure is your job? Anyone nipping at your heels?
>>
>
>

My System SpecsSystem Spec
Old 05-18-2009   #5 (permalink)
Jon LaBarge


 
 

Re: Change share script

Right, but when I create the share with the script, it simply makes it the
default name of the folder. Is there a switch in the script that would allow
it to add the $ in the share name?


"Pegasus [MVP]" <news@xxxxxx> wrote in message
news:ObYWoXA2JHA.5772@xxxxxx
Quote:

> Share are hidden when they have a "$" at the end of their name.
>
>
> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
> news:%23ivCGDA2JHA.1420@xxxxxx
Quote:

>>I forgot to mention that this also need to be a hidden share. Is there a
>>switch that I need to include?
>>
>>
>> "Pegasus [MVP]" <news@xxxxxx> wrote in message
>> news:%23FlPe5$1JHA.4412@xxxxxx
Quote:

>>>
>>> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
>>> news:e8lG3x$1JHA.1712@xxxxxx
>>>> Hello,
>>>>
>>>> I am relatively new to scripting. In an effort to NOT wake up at 1:30
>>>> in the morrning to migrate a share, does anyone know a vbscript to do
>>>> that? Here's what I have (all Win2003):
>>>>
>>>> \\server1\oldshare is the old share. We've migrated the data in the
>>>> share to a SAN and now it's stored in \\server1\newshare
>>>>
>>>> I want a script that will copy the NTFS permissions and then delete the
>>>> share to 'oldshare' while creating the share to 'newshare'
>>>>
>>>> Anyone have a path for me to take here?
>>>>
>>>> TIA!
>>>>
>>>> Jon
>>>
>>> The following three commands will do the trick:
>>> @echo off
>>> net share oldshare /delete
>>> net share newshare="d:\User Files\ShareName"
>>> permcopy.exe {Technical Resource Kit}
>>>
>>> I would actually use robocopy.exe to copy the files to the new
>>> destination - it has a switch to copy NTFS permissions. You can do it
>>> with a VB Script too but you will end up with a much more complex
>>> solution, which requires much more testing and debugging.
>>>
>>> However . . . If this is a production server and if people's ability to
>>> do their job depends on the availability of the various shares then I
>>> would get up at 1:30 am and supervise the delivery of this baby and test
>>> things in full. Most of my clients would take a dim view of me having a
>>> undisturbed rest while their system is falling to pieces. How tolerant
>>> is your boss/client? How secure is your job? Anyone nipping at your
>>> heels?
>>>
>>
>>
>
>

My System SpecsSystem Spec
Old 05-18-2009   #6 (permalink)
Al Dunbar


 
 

Re: Change share script


"Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
news:e5cSkcA2JHA.1372@xxxxxx
Quote:

> Right, but when I create the share with the script, it simply makes it the
> default name of the folder. Is there a switch in the script that would
> allow it to add the $ in the share name?
No, you just put the "$" signs where they need to be - as part of the share
name:

@echo off
net share oldshare$ /delete
net share newshare$="d:\User Files\ShareName"
permcopy.exe {Technical Resource Kit}

But I am curious. The workers will come in the next morning and need to get
at their old data that is now stored at a new UNC location. Will that part
of the change be automated so they will not need to know the UNC?


/Al
Quote:

> "Pegasus [MVP]" <news@xxxxxx> wrote in message
> news:ObYWoXA2JHA.5772@xxxxxx
Quote:

>> Share are hidden when they have a "$" at the end of their name.
>>
>>
>> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
>> news:%23ivCGDA2JHA.1420@xxxxxx
Quote:

>>>I forgot to mention that this also need to be a hidden share. Is there a
>>>switch that I need to include?
>>>
>>>
>>> "Pegasus [MVP]" <news@xxxxxx> wrote in message
>>> news:%23FlPe5$1JHA.4412@xxxxxx
>>>>
>>>> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
>>>> news:e8lG3x$1JHA.1712@xxxxxx
>>>>> Hello,
>>>>>
>>>>> I am relatively new to scripting. In an effort to NOT wake up at 1:30
>>>>> in the morrning to migrate a share, does anyone know a vbscript to do
>>>>> that? Here's what I have (all Win2003):
>>>>>
>>>>> \\server1\oldshare is the old share. We've migrated the data in the
>>>>> share to a SAN and now it's stored in \\server1\newshare
>>>>>
>>>>> I want a script that will copy the NTFS permissions and then delete
>>>>> the share to 'oldshare' while creating the share to 'newshare'
>>>>>
>>>>> Anyone have a path for me to take here?
>>>>>
>>>>> TIA!
>>>>>
>>>>> Jon
>>>>
>>>> The following three commands will do the trick:
>>>> @echo off
>>>> net share oldshare /delete
>>>> net share newshare="d:\User Files\ShareName"
>>>> permcopy.exe {Technical Resource Kit}
>>>>
>>>> I would actually use robocopy.exe to copy the files to the new
>>>> destination - it has a switch to copy NTFS permissions. You can do it
>>>> with a VB Script too but you will end up with a much more complex
>>>> solution, which requires much more testing and debugging.
>>>>
>>>> However . . . If this is a production server and if people's ability to
>>>> do their job depends on the availability of the various shares then I
>>>> would get up at 1:30 am and supervise the delivery of this baby and
>>>> test things in full. Most of my clients would take a dim view of me
>>>> having a undisturbed rest while their system is falling to pieces. How
>>>> tolerant is your boss/client? How secure is your job? Anyone nipping at
>>>> your heels?
>>>>
>>>
>>>
>>
>>
>
>

My System SpecsSystem Spec
Old 05-19-2009   #7 (permalink)
Jon LaBarge


 
 

Re: Change share script

Al,

It's a Citrix Terminal Server topology. Their profiles are stored centrally.

Jon

"Al Dunbar" <alandrub@xxxxxx> wrote in message
news:e1R993C2JHA.5276@xxxxxx
Quote:

>
> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
> news:e5cSkcA2JHA.1372@xxxxxx
Quote:

>> Right, but when I create the share with the script, it simply makes it
>> the default name of the folder. Is there a switch in the script that
>> would allow it to add the $ in the share name?
>
> No, you just put the "$" signs where they need to be - as part of the
> share name:
>
> @echo off
> net share oldshare$ /delete
> net share newshare$="d:\User Files\ShareName"
> permcopy.exe {Technical Resource Kit}
>
> But I am curious. The workers will come in the next morning and need to
> get at their old data that is now stored at a new UNC location. Will that
> part of the change be automated so they will not need to know the UNC?
>
>
> /Al
>
Quote:

>> "Pegasus [MVP]" <news@xxxxxx> wrote in message
>> news:ObYWoXA2JHA.5772@xxxxxx
Quote:

>>> Share are hidden when they have a "$" at the end of their name.
>>>
>>>
>>> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
>>> news:%23ivCGDA2JHA.1420@xxxxxx
>>>>I forgot to mention that this also need to be a hidden share. Is there a
>>>>switch that I need to include?
>>>>
>>>>
>>>> "Pegasus [MVP]" <news@xxxxxx> wrote in message
>>>> news:%23FlPe5$1JHA.4412@xxxxxx
>>>>>
>>>>> "Jon LaBarge" <jon.labarge@xxxxxx> wrote in message
>>>>> news:e8lG3x$1JHA.1712@xxxxxx
>>>>>> Hello,
>>>>>>
>>>>>> I am relatively new to scripting. In an effort to NOT wake up at 1:30
>>>>>> in the morrning to migrate a share, does anyone know a vbscript to do
>>>>>> that? Here's what I have (all Win2003):
>>>>>>
>>>>>> \\server1\oldshare is the old share. We've migrated the data in the
>>>>>> share to a SAN and now it's stored in \\server1\newshare
>>>>>>
>>>>>> I want a script that will copy the NTFS permissions and then delete
>>>>>> the share to 'oldshare' while creating the share to 'newshare'
>>>>>>
>>>>>> Anyone have a path for me to take here?
>>>>>>
>>>>>> TIA!
>>>>>>
>>>>>> Jon
>>>>>
>>>>> The following three commands will do the trick:
>>>>> @echo off
>>>>> net share oldshare /delete
>>>>> net share newshare="d:\User Files\ShareName"
>>>>> permcopy.exe {Technical Resource Kit}
>>>>>
>>>>> I would actually use robocopy.exe to copy the files to the new
>>>>> destination - it has a switch to copy NTFS permissions. You can do it
>>>>> with a VB Script too but you will end up with a much more complex
>>>>> solution, which requires much more testing and debugging.
>>>>>
>>>>> However . . . If this is a production server and if people's ability
>>>>> to do their job depends on the availability of the various shares then
>>>>> I would get up at 1:30 am and supervise the delivery of this baby and
>>>>> test things in full. Most of my clients would take a dim view of me
>>>>> having a undisturbed rest while their system is falling to pieces. How
>>>>> tolerant is your boss/client? How secure is your job? Anyone nipping
>>>>> at your heels?
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Powershell script to enumerate share space PowerShell
Help Please - Script to change IE proxy settings VB Script
Help with Change DNS/WINS PowerShell script PowerShell
Password change script VB Script
Help with Script to Create and Share User Directory PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46