Hello.
I have two computers with installed Windows XP and Server 2003. The part of my task is mapping remote folder. I read this forum and i check my code. It is correct.
$user="user"
$pwd="pwd"
$drive="s:"
$path="\\192.168.1.10\Temp"
$net=New-Object -ComObject WScript.Network
$net.MapNetworkDrive($drive,$path,$true,$user,$pwd)
test-path s:\
When I run this script on the computer with Windows XP SP3 and PowerShell 1.0 I receive "TRUE".But when I run this script on the computer with Windows Server 2003 i receive "FALSE". After second try I receive message
"Exception calling "MapNetworkDrive" with "5" argument(s): "The local device name is already in use."
At D:\Scrypt_vcert-vstore\test\map.ps1:6 char:21
+ $net.MapNetworkDrive <<<< ($drive,$path,$true,$user,$pwd)
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : ComMethodTargetInvocation
False
When I close Shell of PowerShell and run "test-path s:\" I receive "TRUE". I really don't understand what's going on.
Aleksey