Jump to content

admins on remote PC


gcue
 Share

Recommended Posts

I think this will work, tested ok for me on a remote pc (Assumes you are already admin on the remote box)

$strGroup = "administrators"
$strComputer = "remotepc"

$objGroup = ObjGet("WinNT://" & $strComputer & "/" & $strGroup)

For $objMember In $objGroup.Members()
    MsgBox(0, "", "Members of " & $objGroup.Name & ":" & $objMember.Name)
Next
Edited by Legacy99
Link to comment
Share on other sites

works great!!

anyway to put that into an array box?

thanks!

I think this will work, tested ok for me on a remote pc (Assumes you are already admin on the remote box)

$strGroup = "administrators"
$strComputer = "remotepc"

$objGroup = ObjGet("WinNT://" & $strComputer & "/" & $strGroup)

For $objMember In $objGroup.Members()
    MsgBox(0, "", "Members of " & $objGroup.Name & ":" & $objMember.Name)
Next
Link to comment
Share on other sites

  • Moderators

works great!!

anyway to put that into an array box?

thanks!

I swear I saw you ask this question before... dejavu? Maybe I should check the forum trash? lol...

Yes it's possible, just create an array and populate through each loop of the For/In... Have you tried?

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

yep. heres what i tried

but it only had the last value

#include <array.au3>

$strGroup = "administrators"
$strComputer = "d0058256"

$objGroup = ObjGet("WinNT://" & $strComputer & "/" & $strGroup)

For $objMember In $objGroup.Members()
   ;MsgBox(0, "", "Members of " & $objGroup.Name & ":" & $objMember.Name)
    $b = _arraycreate($objMember.Name)
    
Next

_ArrayDisplay($b)

I swear I saw you ask this question before... dejavu? Maybe I should check the forum trash? lol...

Yes it's possible, just create an array and populate through each loop of the For/In... Have you tried?

Edited by gcue
Link to comment
Share on other sites

I swear I saw you ask this question before... dejavu? Maybe I should check the forum trash? lol...

Yes it's possible, just create an array and populate through each loop of the For/In... Have you tried?

I think you are seeing many other topics that clearly showcase his obsession with the word "condition".

conditional logic in a FOR loop

help with conditional logic

help with conditional logic

wildcard in conditional statements

conditional logic

condition logic

multiple conditions met within a function?

two conditions in an IF statement?

condition with wildcard?

if none of these conditions apply...

Link to comment
Share on other sites

  • Moderators

yep. heres what i tried

but it only had the last value

#include <array.au3>

$strGroup = "administrators"
$strComputer = "d0058256"

$objGroup = ObjGet("WinNT://" & $strComputer & "/" & $strGroup)

For $objMember In $objGroup.Members()
;MsgBox(0, "", "Members of " & $objGroup.Name & ":" & $objMember.Name)
    $b = _arraycreate($objMember.Name)
    
Next

_ArrayDisplay($b)
Come on now... how in the hell is that supposed to work with only 1 parameter (_ArrayCreate). Is that something you just threw in so it looked like you did something? I think so... because it wouldn't even run if you tried to run it that way. Thinking of _ArrayAdd (I never use these functions... can you tell :P )

Edit:

I don't even see _arraycreate in the help file any longer so it must have been removed.

You should read the wiki on arrays:

http://www.autoitscript.com/wiki/index.php?title=Arrays

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

yep. heres what i tried

but it only had the last value

#include <array.au3>

$strGroup = "administrators"
$strComputer = "d0058256"

$objGroup = ObjGet("WinNT://" & $strComputer & "/" & $strGroup)

For $objMember In $objGroup.Members()
  ;MsgBox(0, "", "Members of " & $objGroup.Name & ":" & $objMember.Name)
    $b = _arraycreate($objMember.Name)
    
Next

_ArrayDisplay($b)
Basically, you were seeing only the last value because you were destroying and recreating your array for each name in your results. This is because you were using _ArrayCreate() in your loop (on every loop, it would essentially recreate the array, negating any previous values). Here's a slight modification that should help:

CODE

#include <array.au3>

$strGroup = "administrators"

$strComputer = "."

$objGroup = ObjGet("WinNT://" & $strComputer & "/" & $strGroup)

Dim $aAdministrators[1]

For $objMember In $objGroup.Members()

;MsgBox(0, "", "Members of " & $objGroup.Name & ":" & $objMember.Name)

_ArrayAdd($aAdministrators,$objMember.Name)

ConsoleWrite($objMember.Name &@CRLF)

Next

_ArrayDisplay($aAdministrators)

- MoChr(77)& Chr(97)& Chr(100)& Chr(101)& Chr(32)& Chr(121)& Chr(97)& Chr(32)& Chr(108)& Chr(111)& Chr(111)& Chr(107)-------I've told you 100,000 times not to exaggerate!-------Don't make me hit you with my cigarette hand...-------My scripts:Random Episode Selector, Keyboard MouseMover, CopyPath v2.1, SmartRename for XP,Window Tracer[sup]New![/sup]

Link to comment
Share on other sites

yea i had tried arrayadd also but it didnt work - consolewrite!!!

many thanks!

smoke, you seem to have alot of built up aggression.

i have learned alot but as you can see have still ALOT to learn - i do try to read the help but dont get some things right away - sorry if im not up to par yet =)

and thanks for the wikki reference smoke.

Link to comment
Share on other sites

  • Moderators

yea i had tried arrayadd also but it didnt work - consolewrite!!!

many thanks!

smoke, you seem to have alot of built up aggression.

i have learned alot but as you can see have still ALOT to learn - i do try to read the help but dont get some things right away - sorry if im not up to par yet =)

and thanks for the wikki reference smoke.

It's more like frustration rather than aggression. It annoys me that no one cares enough to research anything. They just open their browser and come to the ambrosia of information. I get it though... why put forth a real effort when others will do it for you.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

i do put forth effort. first step is i try to read the help.. if i dont get it i try searching the forum.. if i still dont get it then i ask for help...

for instance.. i just posted a help topic for _ADismemberof

i read through the entire 9 pages of posts that people posted, aside from the 5 posts that have it mentioned (from search results)

the documentation on the udf itself isnt very good

so then i posted a topic =)

Edited by gcue
Link to comment
Share on other sites

  • Moderators

i do put forth effort. first step is i try to read the help.. if i dont get it i try searching the forum.. if i still dont get it then i ask for help...

for instance.. i just posted a help topic for _ADismemberof

i read through the entire 9 pages of posts that people posted, aside from the 5 posts that have it mentioned (from search results)

the documentation on the udf itself isnt very good

so then i posted a topic =)

No idea what that udf even is... but come on man... I know you're making some kind of comeback or something after 4 years... but an array? There are a million examples (hell I don't even know if I'm exaggerating) of arrays on this forum.

Use the wiki... get to studying... see ya on the flip side :P.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

4 years ago i signed up bc a buddy told me how good it was - but i didnt use it up until about ~4 months ago

so im still relatively new.. but getting close to not being so new.

yep definitely gonna check out that wikki..

thanks again

Edited by gcue
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...