Link to home
Create AccountLog in
Avatar of FalconTwo
FalconTwo

asked on

Drive Mappings with powershell

Hello Gurus

I have a windows 2003 domain and I would like to use a PS1 file to map use drives.

Here's what I have so far

# PowerShell Logon Script Example
$net = $(New-Object -ComObject WScript.Network)
$net.MapNetworkDrive("Y:", "\\BWKPW21\GDrive")
$net.MapNetworkDrive("Z:", "\\BWKPW21\RXS")

I would like to remove the drives first then mapped them like we did in the batch logon script.
Thanks for your help. Any additional input will be much appriciated
Avatar of BT15
BT15
Flag of United States of America image

I am pretty sure the code is

$net.removenetworkdrive("y:")
ASKER CERTIFIED SOLUTION
Avatar of BT15
BT15
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Sarang Tinguria
Why powershell ..?
Net use is simple

net use I: /delete
net use J: /delete
net use K: /delete
above is to delete existing drives

net use {drive letter:} \\{machine name} to map new  drives
Avatar of FalconTwo
FalconTwo

ASKER

LOL Hi Sarang, Powershell or vb script  is the way to go now. A whole new world now exist out there
WOW works like a charm thanks
because with powershell you can do anything :)

you are welcome