| 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『楼 主』:
 (已结)求VBS ,自动映射网络磁盘,并改名为 DATA
 
使用 LLM 解释/回答一下
  
我用的是无盘winxp sp2 我想把用户配置文件放到网络文件夹中(开机把网络文件夹映射成本地的D:)我用批处理 
net use d: \\server\%computername%$  %computername%  /user:%computername% 
 
可是批处理是用户登录后才运行的,就会出现出错。 
 
请各位帮我写个脚本文件,用做启动脚本 
 
我描述不清楚,我就案例子说一下 
 
数据服务器计算机名 server 
共享名 A001$、A002$、A003$ ……A040$  
 
客户机计算机名是 001、002、003……040 
 
访问用户名称  A001、A002、A003……A040 
 
共享密码        A001、A002、A003……A040 
 
 
最后再把映射的盘名称改一下为:DATA 
 
谢谢 
 
 Last edited by beyoungse on 2007-9-3 at 12:14 PM ] 
I'm using a diskless WinXP SP2. I want to place user configuration files in a network folder (map the network folder as local D: when booting). I used a batch script: 
 
net use d: \\server\%computername%$  %computername%  /user:%computername% 
 
But the batch script runs after the user logs in, so there's an error. 
 
Please help me write a startup script. 
 
I can't describe clearly, so let's take an example. 
 
Data server computer name: server 
 
Share names: A001$, A002$, A003$ ……A040$ 
 
Client computer names: 001, 002, 003……040 
 
Access user names: A001, A002, A003……A040 
 
Share passwords: A001, A002, A003……A040 
 
Finally, change the mapped drive name to: DATA 
 
 Last edited by beyoungse on 2007-9-3 at 12:14 PM ] 
 
Here's a possible startup script example (assuming you can use a VBScript or a batch with proper handling): 
 
@echo off 
set "server=server" 
set "clientname=%computername%" 
set "sharename=A%clientname%$" 
set "username=A%clientname%" 
set "password=A%clientname%" 
net use d: \\%server%\%sharename% %password% /user:%username% 
if %errorlevel% equ 0 ( 
    ren d: DATA 
) else ( 
    echo Failed to map drive 
) 
 
But you may need to adjust based on your exact environment. Make sure to save this as a .bat file and set it as a startup script in your boot configuration. 
```vbscript 
Set objNetwork = CreateObject("WScript.Network") 
strServer = "server" 
strClientName = WScript.CreateObject("WScript.Shell").ExpandEnvironmentStrings("%computername%") 
strShareName = "A" & strClientName & "$" 
strUserName = "A" & strClientName 
strPassword = "A" & strClientName 
objNetwork.MapNetworkDrive "D:", "\\ " & strServer & "\" & strShareName, False, strUserName, strPassword 
On Error Resume Next 
Set objFSO = CreateObject("Scripting.FileSystemObject") 
objFSO.GetDrive("D:").ShortName = "DATA" 
``` 
    
 
  
 |   
 | 
  2007-9-2 02:15 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 2 楼』:
 
 
使用 LLM 解释/回答一下
  
我在服务器上建立的共享文件名称和密码都是对应下面的工作站的计算机名称 
The name and password of the shared file I set up on the server correspond to the computer names of the following workstations. 
    
 
  
 |   
 | 
  2007-9-2 02:16 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 3 楼』:
 
 
使用 LLM 解释/回答一下
  
还有有什么更好的办法让无盘用户实现个性化,桌面配置环境及外观、快捷方式、开始菜单…… 
 
我用的是工作组 
Is there any better way to enable personalized settings for diskless users, such as desktop configuration environment and appearance, shortcuts, start menu...? 
 
I am using a workgroup. 
    
 
  
 |   
 | 
  2007-9-2 02:25 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 4 楼』:
 
 
使用 LLM 解释/回答一下
  
我现在没有办法试,不知这样可不可以 
 
我刚看到的 
把批处理放在C:\WINDOWS\SYSTEM32\GROUPOLICY\MACHINE\SCRIPTS\下面,并在此编辑SCRIPTS.INI 
内容如下: 
[startup] 
0cmdline=批处理文件名 
0parameters= 
I can't test it now. I don't know if this is okay. 
 
I just saw it. 
Put the batch file in C:\WINDOWS\SYSTEM32\GROUPOLICY\MACHINE\SCRIPTS\ and edit SCRIPTS.INI here. 
The content is as follows: 
 
0cmdline=batch file name 
0parameters= 
    
 
  
 |   
 | 
  2007-9-2 02:46 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 5 楼』:
 
 
使用 LLM 解释/回答一下
  
有没有人帮我写个脚本来的, 
在这先谢谢了 
Is there anyone who can help me write a script? Thanks in advance here 
    
 
  
 |   
 | 
  2007-9-2 10:43 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 6 楼』:
 
 
使用 LLM 解释/回答一下
  
我刚才试  第 4 楼  是不可行的 
What I tried just now, the 4th floor is not feasible 
    
 
  
 |   
 | 
  2007-9-2 13:33 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
 | 
  2007-9-2 14:00 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 8 楼』:
 
 
使用 LLM 解释/回答一下
  
能不能说一下,如何指定用户名称和密码 
 
下面是我用别人写的脚本 
 
Set WshNetwork = WScript.CreateObject("WScript.Network") 
Set WshShell = WScript.CreateObject("WScript.Shell") 
lng_timeout=8 
Wscript.Sleep lng_timeout*1000 
WshNetwork.MapNetworkDrive "D:", "\\server\%computername%$" 
Can you tell me how to specify the user name and password? 
 
The following is the script I used written by someone else: 
 
Set WshNetwork = WScript.CreateObject("WScript.Network") 
Set WshShell = WScript.CreateObject("WScript.Shell") 
lng_timeout=8 
Wscript.Sleep lng_timeout*1000 
WshNetwork.MapNetworkDrive "D:", "\\server\%computername%$" 
    
 
  
 |   
 | 
  2007-9-2 14:25 | 
  
 | 
 | 
 
wudixin96 
银牌会员
 
     
 
  
  
积分 1928 
发帖 931 
注册 2007-1-6 
状态 离线
 | 
『第 9 楼』:
 
 
使用 LLM 解释/回答一下
  
将共享网络驱动器添加到计算机系统中。 
 
object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword]) 
参数 
object  
WshNetwork 对象。  
strLocalName  
表示映射驱动器的本地名的字符串值。  
strRemoteName  
表示共享的 UNC 名称 (\\xxx\yyy) 的字符串值。  
bUpdateProfile  
可选。表示映射信息是否存储在当前的用户配置文件中的布尔值。如果提供的 bUpdateProfile 的值为 true,则该映射存储在用户的配置文件中(默认值为 false)。  
strUser  
可选。表示用户名的字符串值。如果使用当前用户以外的其他用户的凭据来映射网络驱动器,则必须提供该参数。  
strPassword  
可选。表示用户密码的字符串值。如果使用当前用户以外的其他用户的凭据来映射网络驱动器,则必须提供该参数。 
Add a shared network drive to the computer system. 
 
object.MapNetworkDrive(strLocalName, strRemoteName, , , ) 
Parameters 
object  
WshNetwork object.  
strLocalName  
A string value representing the local name of the mapped drive.  
strRemoteName  
A string value representing the UNC name of the share (\\xxx\yyy).  
bUpdateProfile  
Optional. A boolean value indicating whether the mapping information is stored in the current user profile. If the provided value of bUpdateProfile is true, the mapping is stored in the user's profile (default is false).  
strUser  
Optional. A string value representing the user name. If mapping the network drive using credentials of a user other than the current user, this parameter must be provided.  
strPassword  
Optional. A string value representing the user password. If mapping the network drive using credentials of a user other than the current user, this parameter must be provided. 
    
 
  
 |   
 | 
  2007-9-2 14:26 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 10 楼』:
 
 
使用 LLM 解释/回答一下
  
我运行时,提示 编译器错误…… 
 
还有如何改映射磁盘的卷标 
When I run, it prompts a compiler error... And how to change the volume label of the mapped disk 
    
 
  
 |   
 | 
  2007-9-2 14:45 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 11 楼』:
 
 
使用 LLM 解释/回答一下
  
改一下 8楼的VBS  还是不行的 
 
Set WshNetwork = WScript.CreateObject("WScript.Network") 
Set WshShell = WScript.CreateObject("WScript.Shell") 
lng_timeout=8 
Wscript.Sleep lng_timeout*1000 
WshNetwork.MapNetworkDrive "D:", "\\server\%computername%$",“%computername%”,“%computername%” 
Modify the VBS in building 8, still not working 
 
Set WshNetwork = WScript.CreateObject("WScript.Network") 
Set WshShell = WScript.CreateObject("WScript.Shell") 
lng_timeout=8 
Wscript.Sleep lng_timeout*1000 
WshNetwork.MapNetworkDrive "D:", "\\server\%computername%$",“%computername%”,“%computername%” 
    
 
  
 |   
 | 
  2007-9-2 16:03 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
『第 12 楼』:
 
 
使用 LLM 解释/回答一下
  
运行后没有映射成功 
The mapping was not successfully achieved after running. 
    
 
  
 |   
 | 
  2007-9-2 16:03 | 
  
 | 
 | 
 
wudixin96 
银牌会员
 
     
 
  
  
积分 1928 
发帖 931 
注册 2007-1-6 
状态 离线
 | 
『第 13 楼』:
 
 
使用 LLM 解释/回答一下
  
WshNetwork.MapNetworkDrive "D:", "\\server\%computername%$",,“%computername%”,“%computername%” 
 
对了,那几个%computername%变量在vbs不适用吧? 
 
 Last edited by wudixin96 on 2007-9-2 at 04:53 PM ] 
WshNetwork.MapNetworkDrive "D:", "\\server\%computername%$",,“%computername%”,“%computername%” 
 
By the way, are those %computername% variables not applicable in VBS? 
 
 Last edited by wudixin96 on 2007-9-2 at 04:53 PM ] 
    
 
  
 |   
 | 
  2007-9-2 16:51 | 
  
 | 
 | 
 
beyoungse 
中级用户
 
   
 
  
  
积分 253 
发帖 112 
注册 2005-12-20 
状态 离线
 | 
 | 
  2007-9-2 17:07 | 
  
 | 
 | 
 
wudixin96 
银牌会员
 
     
 
  
  
积分 1928 
发帖 931 
注册 2007-1-6 
状态 离线
 | 
『第 15 楼』:
 
 
使用 LLM 解释/回答一下
  
Set objComputer = CreateObject("Shell.LocalMachine") 
 
Wscript.Echo "Computer name: " & objComputer.MachineName 
Set objComputer = CreateObject("Shell.LocalMachine") 
 
Wscript.Echo "Computer name: " & objComputer.MachineName 
    
 
  
 |   
 | 
  2007-9-2 17:30 | 
  
 |