Script Center >
Scripting Forums
>
The Official Scripting Guys Forum!
>
Sharing folder via WMI: Win32_Account from remote?
Sharing folder via WMI: Win32_Account from remote?
- 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
All Replies
- Hi Jakob,
This works for me:
gwmi Win32_Account -computer servername
Bill - 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 - 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- Edited byAbqBillModeratorThursday, July 02, 2009 2:49 PM
- Edited byAbqBillModeratorThursday, July 02, 2009 2:49 PM
- Edited byAbqBillModeratorThursday, July 02, 2009 2:48 PM
- 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 - 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- Proposed As Answer byAbqBillModeratorMonday, August 31, 2009 3:45 AM

