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"
```
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"
```
