Resources for IT Professionals > 포럼 홈 > The Official Scripting Guys Forum! > Sharing folder via WMI: Win32_Account from remote?
질문하기질문하기
 

제안된 답변Sharing folder via WMI: Win32_Account from remote?

  • 2009년 7월 1일 수요일 오전 10:54Jakob Svendsen중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hello everyone

    I have been working on some functions for crating share via WMI (Win32_Share), with custom permissions.

    but i have one issue.

    I use the Win32_Account class to find the user/group's SID, it works great when questioning the local machine.
    but when trying to retrieve them frmo a remote machine, it only gives me the local users.

    I think that this is by design?
    but is there any way i can retrieve the SID's from the remote PC via WMI ?
    (in case this PC is on another domain than me, but i have special permissions to connect via WMI).

    You can download my script at
    http://blog.coretech.dk/scripting/powershell-wmi-working-with-shares-part-1-creating-a-share-with-custom-permissions/

    Please provide any feedback if you have it. I want to continue improving the script (this is version 0.0.1)

    thanks! :)
    Best Regards
    Jakob Gottlieb Svendsen

    Trainer/Consultant - Coretech A/S - Blog - MCT - MCTS - VB.NET - C#.NET - Powershell - VBScript

모든 응답

  • 2009년 7월 1일 수요일 오후 3:26AbqBill중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     코드 있음
    Hi Jakob,

    This works for me:

    gwmi Win32_Account -computer servername
    

    Bill
  • 2009년 7월 2일 목요일 오후 2:21Jakob Svendsen중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     
    Hello

    Thank you for testing


    Does it show all domain users too on your system?

    I was testing from a vista Pc to another vista.




    Trainer/Consultant - Coretech A/S - Blog - MCT - MCTS - VB.NET - C#.NET - Powershell - VBScript
  • 2009년 7월 2일 목요일 오후 2:47AbqBill중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     코드 있음
    Hi Jakob,

    get-wmiobject Win32_Account -computername servername

    only retrieves Win32_Account objects on the named computer. To retrieve domain accounts, you can use

    get-wmiobject Win32_Account -filter "Domain='domainname'"

    HTH,

    Bill
  • 2009년 7월 3일 금요일 오전 8:01Jakob Svendsen중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     코드 있음
    Hello agani :)

    thanks for trying to help :) :)

    but i think you may have misunderstood my problem.

    get-wmiobject Win32_Account -computername servername
    Correct, this retrieves accounts from the remote PC, but only the local accounts from that PC.
    If the PC has joined another domain, you cannot get the accounts from that domain.

    get-wmiobject Win32_Account -filter "Domain='domainname'"
    yes its the same as when i use the [WMI] accellerator on the local PC.
    But this only gives the domain accounts for the doman, from which the local PC is joined.
    if a remote PC has joined another domain that the macihne running the script, you cannot retrieve info on those accounts.

    so my problem is (and i gues it cannot be solved) that i cannot get those accounts, from the remote PC.
    Have a nice weekend! :)


    - Jakob
    Trainer/Consultant - Coretech A/S - Blog - MCT - MCTS - VB.NET - C#.NET - Powershell - VBScript
  • 2009년 7월 3일 금요일 오후 4:03AbqBill중재자사용자 메달사용자 메달사용자 메달사용자 메달사용자 메달
     제안된 답변
    Hi Jakob,

    A brief search didn't reveal such such a limitation provided your script provides appropriate credentials to allow it to query accounts on a different domain. In that case, my thought would be to query the accounts on a domain controller rather than a member machine. But I am unable to test here as I only have a single domain.

    Regards,

    Bill
    • 답변으로 제안됨AbqBill중재자2009년 8월 31일 월요일 오전 3:45
    •