Home > Software engineering >  How to use the batch change the network mapping dish network path
How to use the batch change the network mapping dish network path

Time:10-04

Hi,

Now there is such a situation
Within the company have a file server, file server opened a network Shared disk, each user has one or more network mapping set,
But the staff did not add domain, then give the mapping of the time is based on IP path, such as (192.168.1.23), companies now realise that change the server IP, the original address, there is no work, need to change the IP domain name for the machines, after that change the IP, also need not change in address,
Help:
1: how to use the batch to replace the current staff all Shared disk path,
2: how to use the batch automatically create employees Shared disk for original domain,
3: in a staff only one, or more of the Shared disk, replace the automatic identification, when you need to

CodePudding user response:

Give you a reference:
 
The Set objNetwork=WScript. CreateObject (" work "WScript.Net
The Set colDrives=objNetwork. EnumNetworkDrives
For I=0 to colDrives. Count - 1 Step 2
ObjNetwork. RemoveNetworkDrive colDrives. Item (I), true, true
Next
The Set objNetwork=Nothing

Dim netdrive
The set netdrive=CreateObject (" work "wscript.net
Netdrive. MapNetworkDrive "x", "\ \ ADDC $\ \ scool manager"
Netdrive. MapNetworkDrive "y", "\ \ ADDC $\ \ scool project", "
Netdrive. MapNetworkDrive "z:", "\ \ ADDC \ scool $\ public"
The set netdrive=nothing

Dim netrename
The set netrename=CreateObject (" Shell. Application ")
Netrename. NameSpace (" x "). The Self. The Name="Manager"
Netrename. NameSpace (" y "). The Self. The Name="Project"
Netrename. NameSpace (" z: ".) the Self. The Name="Public"
The set netrename=nothing

Dim netprinter
The Set netprinter=CreateObject (" work "WScript.Net
Netprinter. AddWindowsPrinterConnection \ \ "PDC \ receptionist"
Netprinter. AddWindowsPrinterConnection \ \ "PDC \ ajpaul"
Netprinter. AddWindowsPrinterConnection \ \ "PDC \ accounting"
Netprinter. AddWindowsPrinterConnection \ \ "PDC \ upstairs"
Netprinter. AddWindowsPrinterConnection \ \ "PDC \ logistics"
Netprinter. AddwindowsPrinterConnection \ \ "PDC \ canonps"
The set netprinter=nothing

CodePudding user response:

Make a batch file a.c md
 NET USE & gt; B.t xt 
C.e xe


Write a program c.e xe read b.t xt file, file output, dc md,
One by one from TXT file parsing acquired operator and the network path, if the property to replace the path, to the CMD file is written to the following two lines
 NET USE drive/DELETE 
NET USE drive replacement path

The program is invoked with shell statement, dc md batch,

As long as replication a.c md and c.e xe have a directory of read and write access to the current employees, perform a.c md is ok,

CodePudding user response:

Reference
companies now realise that change the server IP, the original address, there is no work, need to change the IP domain name for the machines, after that change the IP, also need not change in address,


Company will realize in the future, as long as you set up a domain, no matter where employees on the computer can use their own login user name, and what to share set printer setup, etc) no difference.

After all, the IT manager of your company only the Internet bar
  • Related