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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Check logged on user with VB Script?

  • 17-07-2007 1: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