Jump to content
Sign in to follow this  
vnavna

Rename Hidden user share with Username

Recommended Posts

vnavna

I can get everything to work except to rename the username drive to the windows user. Is there a way to implement %Username% to rename the share?

DriveMapDel("F:")

Sleep(1000)

$driveLetter = "F:"

DriveMapAdd($driveLetter, "\\Server Name\Sys",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "SYS"

DriveMapDel("G:")

Sleep(1000)

$driveLetter = "G:"

DriveMapAdd($driveLetter, "\\Server Name\Groups",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "Groups"

DriveMapDel("L:")

Sleep(1000)

$driveLetter = "L:"

DriveMapAdd($driveLetter, "\\Server Name\Local",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "Local"

DriveMapDel("S:")

Sleep(1000)

$driveLetter = "S:"

DriveMapAdd($driveLetter, "\\Server Name\Setup",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "Setup"

DriveMapDel("T:")

Sleep(1000)

$driveLetter = "T:"

DriveMapAdd($driveLetter, "\\Server Name\Safety Training",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "Safety Training"

DriveMapDel("W:")

Sleep(1000)

$driveLetter = "U:"

DriveMapAdd($driveLetter, "\\Server Name\" & @Username & "$",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "@Username"

Share this post


Link to post
Share on other sites
PsaltyDS

I can get everything to work except to rename the username drive to the windows user. Is there a way to implement %Username% to rename the share?

<snip>

$driveLetter = "U:"

DriveMapAdd($driveLetter, "\\Server Name\" & @Username & "$",1)

$oShell = ObjCreate("shell.application")

$oShell.NameSpace($driveLetter).Self.Name = "@Username"

The macro should not be in quotes:
$oShell.NameSpace($driveLetter).Self.Name = @Username

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
vnavna

The macro should not be in quotes:

$oShell.NameSpace($driveLetter).Self.Name = @Username

:)

That did it. Thanks a lot. You are the man.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×