Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Check logged on user with VB Script?

  • 17-07-2007 02:11PM
    #1
    Registered Users, Registered Users 2 Posts: 2,835 ✭✭✭


    Lads,

    I have a basic Visual Basic script set up for deleting old user profiles on multi-user machines, and the only bit i'm having trouble i'm having is how to check who the current user logged in is?

    i want to get this ID (eg. vinnyl ) and use it so that the script doesn't attempt to delete the current logged in users profile... can any of you help?

    Vin


Comments

  • Closed Accounts Posts: 669 ✭✭✭pid()


    You could try using WMI, or the NetWkstaUserEnum Win32 api to retrieve the information.


  • Registered Users, Registered Users 2 Posts: 2,835 ✭✭✭StickyMcGinty


    i'm trying to avoid doing anything over the .net framework though, all i want to do is check the current logged in user on the machine so that the script doesnt try and delete their profile...


  • Registered Users, Registered Users 2 Posts: 2,931 ✭✭✭Ginger


    set objNetwork = createobject("wscript.network")
    wscript.echo objNetwork.Username
    

    Should do it


Advertisement