Mombu the Microsoft Forum sponsored links

Go Back   Mombu the Microsoft Forum > Microsoft > Windows 2003 Server (TECHNET) > Script to copy all mapped drives and network printers and them import them to another computer.
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 13th July 06:55
brock_griffin
External User
 
Posts: 1
Default Script to copy all mapped drives and network printers and them import them to another computer.


Hi all. I'm not sure if I can do this or not, but I'm looking for
someon who has a script to share, or input on how to help me tweak a
script I have. The script right now enumerates both network drives and
network printers and posts them to two seperate files that reside on my
server. I would like to basically reverse the script so that it pulls
the mapped drives and printers from the text files and connects them on
the machine running the script. I would like this simply because we do
a lot of "rebuilds" on computers, and it seems that the MS File and
Transfer doohicky doesn't work well all the time, especially when
copying files from an SP1 computer and then installign them back on the
SP2 image.

First of all, can this be done, and second, could someone help? here
is the script I have to copy the drives and printers.

Thanks.

' This script enumerates the network drives
' and exports them to c:\DriveInfo.ttxt

MyFile = "C:\_PROFILEINFO.txt"
Dim filesys, profileinfo
Set fso = CreateObject("Scripting.FileSystemObject")
Set profileinfo= fso.OpenTextFile(myFile, 8, True)

Set objNetwork = WScript.CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
profileinfo.WriteLine " "
profileinfo.WriteLine
"************************************************* *******************"
profileinfo.WriteLine colDrives.Item(i) & vbTab & colDrives.Item (i +
1)
profileinfo.WriteLine
"************************************************* *******************"

Next

' This script enumerates the printers and exports any printer
' connections that begin with \\ to c:\printers.txt

Set objNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = objNetwork.EnumPrinterConnections
For i = 0 to colPrinters.Count-1 Step 2
profileinfo.WriteLine " "
profileinfo.WriteLine
"************************************************* *******************"
profileinfo.WriteLine colPrinters.Item(i) & vbTab & colPrinters.Item (i
+ 1)
profileinfo.WriteLine
"************************************************* *******************"
Next

MyFile2 = "C:\_MappedDrives.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set MappedDrives= fso.OpenTextFile(myFile2, 8, True)
Set objNetwork = WScript.CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
MappedDrives.WriteLine colDrives.Item(i) & vbTab & colDrives.Item (i +
1)
Next

MyFile3 = "C:\_MappedPrinters.txt"
Set fso = CreateObject("Scripting.FileSystemObject")
Set MappedPrinters= fso.OpenTextFile(myFile3, 8, True)

Set objNetwork = WScript.CreateObject("WScript.Network")
Set colPrinters = objNetwork.EnumPrinterConnections
For i = 0 to colPrinters.Count-1 Step 2
MappedPrinters.WriteLine colPrinters.Item (i + 1)
Next

Any help would be greatly appriciated!

P.S. In case your wondering why I have the pulling twice, I have one
text file that is a PROFILEINFO which is basically a listing of all
drives and printers. this is just for a backup copy. The other two
files are without any extra spaces or lines and will be used for the
import of the drives back into the comptuers.
  Reply With Quote


  sponsored links


2 13th July 06:56
d r
External User
 
Posts: 1
Default Script to copy all mapped drives and network printers and them import them to another computer.


Hi Brock,
You can use the Microsoft Printer Migration v3.1 tool for transfer of
printers, and it can run from command line too.
Regards,
Dave.
  Reply With Quote
3 13th July 06:56
brock_griffin
External User
 
Posts: 1
Default Script to copy all mapped drives and network printers and them import them to another computer.


What about for mapped drives??
  Reply With Quote
4 13th July 06:57
d r
External User
 
Posts: 1
Default Script to copy all mapped drives and network printers and them import them to another computer.


Hi Brock,

What about the "USMT" (User State Migration Tool), it's different from the
"Files and Settings Transfer Wizard"?

The USMT overview can be found here;
http://www.microsoft.com/windowsxp/using/setup/expert/russel_november19.mspx

Regards,
Dave.
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666