Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Check logged on user with VB Script?

Options
  • 17-07-2007 2:11pm
    #1
    Registered Users 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 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 Posts: 2,931 ✭✭✭Ginger


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

    Should do it


Advertisement