+ Reply to Thread
Results 1 to 6 of 6

Getting Workgroup ID??

  1. #1

    Getting Workgroup ID??

    Our company has various offices, and i am trying to define which server
    the user is on.

    eg at login
    thecompany.Edinburgh.tree
    thecompany.Glasgow.tree

    I have no idea of how to find the server via excel however.

    Rightclicking on "my computer" and going to the "computer name" tab,
    allows me to see the Full computer name and the workgroup. (The
    workgroup being "EDINBURGH")

    I came across this macro in my searching and it has the UserDomain
    which is the same as the "computer name"

    Sub env()
    Dim EnvString As String
    Indx = 1
    Do
    EnvString = Environ(Indx)
    Cells(Indx, 1) = EnvString
    Indx = Indx + 1
    Loop Until EnvString = ""
    End Sub

    So i was wondering if there was any way to get the workgroup.

    I also tried getting the server via the groupwise library, but failed
    miserably. I thought if i could get the current users
    DistinguishedName (NDS) or Groupwise email address as opposed to the
    normal email address, i could parse out the extra data.

    If anyone can advise on how this might be achieved i shall be extremely
    grateful.

    regards
    George


  2. #2
    Carim
    Guest

    Re: Getting Workgroup ID??

    Hi George,

    Would application.networktemplatespath
    be of any help ?

    Carim


  3. #3
    Carim
    Guest

    Re: Getting Workgroup ID??

    Hi George,

    Would application.networktemplatespath
    be of any help ?

    Carim


  4. #4
    Henrich
    Guest

    RE: Getting Workgroup ID??

    Hi, try this:

    Private Declare Function GetUserName Lib "advapi32.dll" _
    Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
    As Long
    Sub User_Name()
    Dim Buffer As String * 100
    Dim BuffLen As Long
    BuffLen = 100
    GetUserName Buffer, BuffLen
    UserName = Left(Buffer, BuffLen - 1)
    MsgBox UserName
    End Sub

    It should give you the workgroupe name.

    „[email protected]" napĂ*sal (napĂ*sala):

    > Our company has various offices, and i am trying to define which server
    > the user is on.
    >
    > eg at login
    > thecompany.Edinburgh.tree
    > thecompany.Glasgow.tree
    >
    > I have no idea of how to find the server via excel however.
    >
    > Rightclicking on "my computer" and going to the "computer name" tab,
    > allows me to see the Full computer name and the workgroup. (The
    > workgroup being "EDINBURGH")
    >
    > I came across this macro in my searching and it has the UserDomain
    > which is the same as the "computer name"
    >
    > Sub env()
    > Dim EnvString As String
    > Indx = 1
    > Do
    > EnvString = Environ(Indx)
    > Cells(Indx, 1) = EnvString
    > Indx = Indx + 1
    > Loop Until EnvString = ""
    > End Sub
    >
    > So i was wondering if there was any way to get the workgroup.
    >
    > I also tried getting the server via the groupwise library, but failed
    > miserably. I thought if i could get the current users
    > DistinguishedName (NDS) or Groupwise email address as opposed to the
    > normal email address, i could parse out the extra data.
    >
    > If anyone can advise on how this might be achieved i shall be extremely
    > grateful.
    >
    > regards
    > George
    >
    >


  5. #5

    Re: Getting Workgroup ID??

    Hi guys

    Unfortunately Application.NetworkTemplatesPath gives the drive on the
    server where the templates are K:
    It does not tell me what server this is on.

    Henrich, this gives me the username not the workgroup name
    So i am getting the login intitals instead of Edinburgh

    Thanks for looking at this. Any other ideas?


    Henrich wrote:
    > Hi, try this:
    >
    > Private Declare Function GetUserName Lib "advapi32.dll" _
    > Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) _
    > As Long
    > Sub User_Name()
    > Dim Buffer As String * 100
    > Dim BuffLen As Long
    > BuffLen =3D 100
    > GetUserName Buffer, BuffLen
    > UserName =3D Left(Buffer, BuffLen - 1)
    > MsgBox UserName
    > End Sub
    >
    > It should give you the workgroupe name.
    >
    > ,,[email protected]" nap=EDsal (nap=EDsala):
    >
    > > Our company has various offices, and i am trying to define which server
    > > the user is on.
    > >
    > > eg at login
    > > thecompany.Edinburgh.tree
    > > thecompany.Glasgow.tree
    > >
    > > I have no idea of how to find the server via excel however.
    > >
    > > Rightclicking on "my computer" and going to the "computer name" tab,
    > > allows me to see the Full computer name and the workgroup. (The
    > > workgroup being "EDINBURGH")
    > >
    > > I came across this macro in my searching and it has the UserDomain
    > > which is the same as the "computer name"
    > >
    > > Sub env()
    > > Dim EnvString As String
    > > Indx =3D 1
    > > Do
    > > EnvString =3D Environ(Indx)
    > > Cells(Indx, 1) =3D EnvString
    > > Indx =3D Indx + 1
    > > Loop Until EnvString =3D ""
    > > End Sub
    > >
    > > So i was wondering if there was any way to get the workgroup.
    > >
    > > I also tried getting the server via the groupwise library, but failed
    > > miserably. I thought if i could get the current users
    > > DistinguishedName (NDS) or Groupwise email address as opposed to the
    > > normal email address, i could parse out the extra data.
    > >
    > > If anyone can advise on how this might be achieved i shall be extremely
    > > grateful.
    > >=20
    > > regards
    > > George
    > >=20
    > >



  6. #6

    Re: Getting Workgroup ID??

    Thanks to all who looked at this

    Found the answer here http://support.microsoft.com/kb/q148835/
    Works for XP as well. It is the langroup i was trying to get.

    Now why didn't i think of coding it like that :o

    Many thanks again to all who gave this a bash.
    George

    [email protected] wrote:
    > Our company has various offices, and i am trying to define which server
    > the user is on.
    >
    > eg at login
    > thecompany.Edinburgh.tree
    > thecompany.Glasgow.tree
    >
    > I have no idea of how to find the server via excel however.
    >
    > Rightclicking on "my computer" and going to the "computer name" tab,
    > allows me to see the Full computer name and the workgroup. (The
    > workgroup being "EDINBURGH")
    >
    > I came across this macro in my searching and it has the UserDomain
    > which is the same as the "computer name"
    >
    > Sub env()
    > Dim EnvString As String
    > Indx = 1
    > Do
    > EnvString = Environ(Indx)
    > Cells(Indx, 1) = EnvString
    > Indx = Indx + 1
    > Loop Until EnvString = ""
    > End Sub
    >
    > So i was wondering if there was any way to get the workgroup.
    >
    > I also tried getting the server via the groupwise library, but failed
    > miserably. I thought if i could get the current users
    > DistinguishedName (NDS) or Groupwise email address as opposed to the
    > normal email address, i could parse out the extra data.
    >
    > If anyone can advise on how this might be achieved i shall be extremely
    > grateful.
    >
    > regards
    > George



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1