I'm not looking for User SIDs. I'm looking for the computer SID, which active directory would use to uniquely identify the computer. I also don't want to query the active directory server, i want to query the computer itself.
相关问题
- How to Debug/Register a Permanent WMI Event Which
- Inheritance impossible in Windows Runtime Componen
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 如何通过命令行测试dns反向解析
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- CosmosDB emulator can't start since port is al
- SQL identity (1,1) starting at 0
You can simply run
reg query HKLM\SOFTWARE\Microsoft\Cryptography /v MachineGuid
from Windows command line.Here is Windows batch file example:
Found a tool from microsoft website which can get you the SID easily
http://technet.microsoft.com/en-us/sysinternals/bb897417.aspx
Just download the file, unzip it, open a command prompt and then run psgetsid.exe.
There are some good explanation on SID from microsoft website as well
http://blogs.msdn.com/b/aaron_margosis/archive/2009/11/05/machine-sids-and-domain-sids.aspx
(Ooh, this was a fun one! I went on a wild goose chase, as they say, trying to get the Win32_SID instance, which is a singleton and not enumerable by the usual InstancesOf or Query methods... yadda yadda yadda.)
Well, it depends which computer SID you want (seriously!). There's the SID that the local computer uses for itself... For this, you just need to get the SID of the local Administrator user, and remove the "-500" from the end to get the computer's SID.
In VBScript, it looks like this:
In PowerShell, like this:
In C# on .NET 3.5:
Results from all of these match the response I get from PsGetSid.exe.
On the other hand, there's the SID that Active Directory uses to identify each domain member computer... That one you fetch by getting the SID of the machine account in the domain--the one that ends with a dollar sign.
E.g., using the above PowerShell function for a domain member called "CLIENT", you can type
get-sid "CLIENT$"
.