Windows XP Community - XPHeads



MapNetworkDrive without drive letter does what?

microsoft.public.windowsxp.general


Reply
  #1 (permalink)  
Old 01-24-2008, 02:13 PM
polykobol@gmail.com
 
Posts: n/a
MapNetworkDrive without drive letter does what?
I'm looking for a very simple way in VBScript for checking if the
current user has Administrative rights on his Windows XP machine. I
searched through the web and came up with this:

http://groups.msn.com/windowsscript/...ortstring=1a2a

Since I cannot be sure which drives the users has mapped already I
simply tried to remove the drive letter and it seems to work!

Function CurrentUserIsAdministrator()
Dim nw
CurrentUserIsAdministrator = True

Set nw = WScript.CreateObject("WScript.Network")

On Error Resume Next
nw.MapNetworkDrive "", "\\" & nw.ComputerName & "\Admin$"
If Err.number <> 0 Then
CurrentUserIsAdministrator = False
Err.Clear
End If
On Error Goto 0
End Function

What exactly does the above do? It seems to work exactly the way I
want it to, but according to MS the first parameter of MapNetworkDrive
cannot be empty. If I try to map a shared folder manually I also have
the option "(none)" to choose from among all the drive letters. The
only thing that happens then seems to be that the folder opens...or is
something happening that I don't notice?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 01-24-2008, 02:39 PM
Pegasus \(MVP\)
 
Posts: n/a
Re: MapNetworkDrive without drive letter does what?

<polykobol@gmail.com> wrote in message
news:580ded62-696d-4434-ace4-ae790ee2bfd2@q39g2000hsf.googlegroups.com...
> I'm looking for a very simple way in VBScript for checking if the
> current user has Administrative rights on his Windows XP machine. I
> searched through the web and came up with this:
>
> http://groups.msn.com/windowsscript/...ortstring=1a2a
>
> Since I cannot be sure which drives the users has mapped already I
> simply tried to remove the drive letter and it seems to work!
>
> Function CurrentUserIsAdministrator()
> Dim nw
> CurrentUserIsAdministrator = True
>
> Set nw = WScript.CreateObject("WScript.Network")
>
> On Error Resume Next
> nw.MapNetworkDrive "", "\\" & nw.ComputerName & "\Admin$"
> If Err.number <> 0 Then
> CurrentUserIsAdministrator = False
> Err.Clear
> End If
> On Error Goto 0
> End Function
>
> What exactly does the above do? It seems to work exactly the way I
> want it to, but according to MS the first parameter of MapNetworkDrive
> cannot be empty. If I try to map a shared folder manually I also have
> the option "(none)" to choose from among all the drive letters. The
> only thing that happens then seems to be that the folder opens...or is
> something happening that I don't notice?


It creates a UNC path to a share on some machine, which is
visible in "My Computer" as a shared drive without drive letter.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 01-24-2008, 02:50 PM
polykobol@gmail.com
 
Posts: n/a
Re: MapNetworkDrive without drive letter does what?
On 24 Jan, 15:39, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
>
> It creates a UNC path to a share on some machine, which is
> visible in "My Computer" as a shared drive without drive letter.


Hmm...I can't find it in "My Computer", but I can see it if I run "NET
USE".

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:42 AM.


Registry Mechanic - Free Scan Now
Driver Scanner 2009 - Free Scan Now




Design by Vjacheslav Trushkin for phpBBStyles.com.
Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74