Jump to content

Rename Hidden user share with Username


vnavna
 Share

Recommended Posts

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"

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...