Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Disable Guest Accounts on Win32 PC's

by SteveS832001 (Sexton)
on Mar 15, 2006 at 04:15 UTC ( [id://536772]=perlquestion: print w/replies, xml ) Need Help??

SteveS832001 has asked for the wisdom of the Perl Monks concerning the following question:

I am trying to disable the Guest accounts on all the pc's in my network (300 pc) I am having trouble with the AdminMisc::UserSetMiscAttributes this is what i have tried to disable it on my local pc and it doesn;t seem to work I need to get this done asap (Examiners are coming) You can use AdminMisc or NetAdmin doesn't matter to me
Update My AdminMisc is not working so that is part of my problem
use Win32; use Win32::NetAdmin; use Win32::AdminMisc; print "Enter the (ip or name) of the remote PC\n"; $server = (<stdin>); chomp($server); $user = "Guest"; my %users; my %detail; Win32::NetAdmin::GetUsers($server, FILTER_NORMAL_ACCOUNT, \%users); foreach (%users) { print "$_\n"; } Win32::AdminMisc::UserGetMiscAttributes ($server, $user, \%detail); $Hash{USER_FLAGS} = $Hash{USER_FLAGS} | UF_ACCOUNTDISABLE; Win32::AdminMisc::UserSetMiscAttributes ($server, $user, USER_FLAGS, $ +Hash{USER_FLAGS} );

2006-03-15 Retitled by Corion, as per Monastery guidelines
Original title: 'Help'

Replies are listed 'Best First'.
Re: Disable Guest Accounts on Win32 PC's
by davidrw (Prior) on Mar 15, 2006 at 04:59 UTC
    You should always do use strict; and use warnings; -- it would have helped catch this error... Your UserGetMiscAttributes call is storing the result in %detail but the rest of the code is using %Hash. Hopefully Win32::AdminMisc will work for you with that change..
Re: Disable Guest Accounts on Win32 PC's
by PodMaster (Abbot) on Mar 15, 2006 at 05:07 UTC
    Doesn't work? use strict; use warnings; (and resolve errors revealed by using these two ). Check for return values and error messages ($!, $^E, Win32::AdminMisc::GetError()).

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://536772]
Approved by spiritway
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-03-28 13:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found