Sign in to follow this  
Followers 0
devilman16

check if remote pc is powered on and you have admin permissions

7 posts in this topic

Hello,

I am searching for a better (faster) way to check if a remote Windows PC is powered on and you have admin permissions then using fileexists on a admin share?

Because now I do it this way:

$IP = 192.168.1.100
If ping($IP) <> 0 then
    $online = True
    If  FileExists("\\" & $IP & "\admin$\explorer.exe") Then
        $admin = true
    Else
        $admin = false
    EndIf
Else
    $online = false
EndIf

Because the timeout on accessing SMB shares is very long this can take a while if you check 50+ PC's (also the application is writing "not responding" during this time)

Is there a faster/better way to check if the PC is powered on and you have admin permissions then Fileexists on the admin share?

Thanks for your help!

Share this post


Link to post
Share on other sites



@jguinch yes i now but it's the same text ping

how to found with google 5 sec found ping autoit google 3 sec

Share this post


Link to post
Share on other sites

Maybe with WMI ?

If IsObj( ObjGet("winmgmts:\\" & $IP & "\root\CIMV2")) Then
    MsgBox(0, "", "The remote computer is alive and the account is an admin")
Else
    MsgBox(48, "", "Unable to connect to the remote computer.")
EndIf

Share this post


Link to post
Share on other sites

@Spider001 if you look at my code than you see I use ping before fileexists and yes it helps to sort out PC's that are offline,

but it dont give me information about the OS if its completely booted or if i have admin rights

@jguinch WMI is also a good idea, but I ask WMI after fileaccess because in my opinion WMI is more complicate than SMB (random port and problems with Firewall)

Any ideas left?

Share this post


Link to post
Share on other sites

if the main issue is wasting time waiting for the remote pc's to respond in turn, and you have a relatively fixed inventory of pc's then, set-up a monitoring system. consult the monitoring system before performing your admin test.

(regardless, if you are managing a network, a monitoring system is kind of a must-have, to my opinion).

if your inventory of pc's is changing constantly, then search the forum for several solutions and methods for simultaneous pinging. here are some you may find interesting:

'?do=embed' frameborder='0' data-embedContent>>

'?do=embed' frameborder='0' data-embedContent>>

'?do=embed' frameborder='0' data-embedContent>>

and an external link:

http://windowsitpro.com/windows/worry-free-way-ping-remote-computers

basically, the simple way is:

the main script calls several Run() to ping, and redirects ping output to a file or another buffer which can be read later. each Run() creates a separate process, so they are not waiting for each other. when all are done, the main script can parse the output of each ping, and continue checking only the alive pc's.

there are more complex ways of doing it, but they are... well... complex.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0