inicio > ejecutar > cmd
c:\> set
te dará todas las variables de entorno, computername, username, ...
c:\> echo %USERDOMAIN%
midominio
c:\> echo %LOGONSERVER%
\\miservidor
c:\> echo %USERNAME%
miusuario
Y para saber tu LDAP:
http://msdn.microsoft.com/en-us/libr...36(VS.85).aspx
Código:
rem visual basic
Dim rootDSE As IADs
Dim DistinguishedName As String
Set rootDSE = GetObject("LDAP://rootDSE")
DistinguishedName = "LDAP://" & rootDSE.Get("defaultNamingContext")
Y para vbs imtentalo con
Código:
Dim rootDSE
Dim DistinguishedName
Set rootDSE = GetObject("LDAP://rootDSE")
DistinguishedName = "LDAP://" & rootDSE.Get("defaultNamingContext")
C++
Código:
IADs *pads;
hr = ADsGetObject( L"LDAP://rootDSE",
IID_IADs,
(void**)&pads);
if(SUCCEEDED(hr))
{
VARIANT var;
VariantInit(&var);
hr = pads->Get(CComBSTR("defaultNamingContext"), &var);
if(SUCCEEDED(hr))
{
if(VT_BSTR == var.vt)
{
wprintf(var.bstrVal);
}
VariantClear(&var);
}
pads->Release();
}
PowerShell
Código:
PowerShell version Simon Garratt | Edit | Show History
Please Wait
$rootDSE = ([ADSI]"LDAP://RootDSE")
"defaultNamingContext = " + $rootDSE.defaultNamingContext
"rootdomainNamingContext = " + $rootDSE.rootDomainNamingContext
"configurationNamingContext = " + $rootDSE.configurationNamingContext
"dnsHostName = " + $rootDSE.dnsHostName
$domainFunctionality = $rootDSE.domainFunctionality
switch ($domainFunctionality)
{
0 { "Windows 2000 Domain Mode" }
1 { "Windows Server 2003 Interim Domain Mode" }
2 { "Windows Server 2003 Domain Mode" }
}
salu2