How to get user name instead of SID during WMI logcollection - windows

I'm looking for a possible solution to convert a Windows user SID to a username.
I am running WQL queries against some local namespace and would like to know if there are any possibilities to get a username instead SID like an event viewer. I am using WBEMTest for testing.
Screenshot for reference.

SELECT * FROM Win32_AccountSID should get you a list you can match the SID to the name.

Related

SCCM Configuration Baseline Name table

Can you please help point me to the right direction as to where I can find the table to map the Name of the Configuration Baseline in SCCM?screenshot
Thanks in advance!
I will share my experience for finding specific wmi class or DB tables for Configuration Manager. It may not be the best way, but I find it really helpful for me to get what I want.
To get WMI Class:
Open CM Admin Console in Debugview Mode. It's easy do by adding sms:debugview at the end of console shortcut property target label.
For example: "C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\Microsoft.ConfigurationManagement.exe" sms:debugview
After opening console in DebugView mode, you'll find that there is an extra workspace called Tools. (You'll find it's a tool to view all WMI Classes on site server)
In your case, right click the baseline and select 'Show Object Details' (this is added in debug view mode), you'll notice that you're redirected to Tools workspace and it's showing the baseline WMI Class instance , you'll see all the properties. For example, the name is listed as LocalizedDisplayName. In this case, the baseline WMI Class is SMS_ConfigurationBaselineInfo.
You then can Join any other WMI classes to this one on any property.
To get SQL DB Views:
You can use specific keyword and a simple query to find some related views and you'll then be able to find the one you need. keyword is important and can be for example a key word in above WMI Class name.
select * from INFORMATION_SCHEMA.TABLES
where TABLE_NAME like '%baseline%'
Add
and table_type = 'View'
in the end if you only want to get only views.
It's rarely advisable to read anything from the tables directly, and you should instead use the views provided by MS.
Not at work at the moment, so can't check, but I suspect you'll be wanting to look at the DisplayName column in v_LocalizedCIProperties.

Automatise Adduser for Windows Active Directory 2008

I would like to add a lot of users into my Active Directory Users Group based on a csv with specifics informations like phone numero, email, job ...
I look around the internet and found a "method" using powershell. But, it's always to add basic infos like Name, Surname, Login and password.
Is there a webpage referencing the New-ADuser cmd ?
I found something on this website
http://blogs.technet.com/b/pascals/archive/2013/08/09/cr-233-er-des-utilisateurs-de-test-dans-ad-avec-un-mini-script-powershell.aspx
Thanks,
I usually use the Quest AD cmdlets which makes easier the AD manipulation.
You can download the cmdlets from here.
You can also add phone number, webpage, etc. by default, or you can use the -IncludedProperties for addition.
Here is the syntax for the new user creation.

Active Directory Search query buid

I am trying to find a list of users that are DISABLED ( no locked )
This users must have a home folder mapped and the folder starts with \\userdatasrv\
I manged to find the custom filter for the home folder:
(&(objectCategory=user)(objectClass=user)(homeDirectory=\5c\5cuserdatasrv*))
also I found some examples for disabled users on the internet but I can't make them work together.
Please advise.
Thank you.
I think you should be able to use a search filter that looks something like this:
(&(objectCategory=person)(objectClass=User)(userAccountControl:1.2.840.113556.1.4.803:=2)(homeDirectory=\5c\5cuserdatasrv*))
Also remember to use objectCategory person. The objectCategory for a user object is not user it is person and objectClass is not enough since computer class is a sublclass of user. objectCategory will give you both user objects and contact objects.
This will only include accounts that are disabled. For more information about using bitwise filters see this page: http://support.microsoft.com/kb/269181

Crystal Report Dynamic parameter prompting user name and password

I am using CR 2008. That version allows the use dynamic parameters instead of static parameter. Using that type of parameter will direct CR to go inside the table/view and display what is resided inside the database for us to select the data/information for filtering. That is nice and convenient feature but each time I run the report, I was prompted with server name, user name and password. The user name is the name of the schema and its related password. Those credentials are not supposed to be disclosed to users.
Have anyone come across the same issue and how do you stop CR report from asking for these credentials? It did not ask when I switch to static parameters... the prompt only shows up when dynamic parameters are used.
Thanks!
I finally found a way to get around this issue. In my Crystal report, I used SQL statement in the command for easy future maintenance. I think using command triggers the prompt for user name and password when dynamic parameters is used. I switched to use views for my reports and CR stopped asking me for the credentials. I still favor using commands instead of views though and still curious if there is a way to stop CR from prompting for credential in dynamic parameters when command is used.
Are facing this issue in CR tool or in any other environment which is used to view the report.

Get the complete username a new username

When using NetUserAdd the user will be created on the local computer or as a domain account depending the role of the server where you used this function.
I want to retrieve the complete username (LOCALCOMPUTER\USERNAME or DOMAIN\USERNAME) to use it remotely.
Is there a function to do this?
Caveat: I haven't checked the solution.
You may call NetGetJoinInformation to know if the machine belongs to a domain and NetServerGetInfo if the code is running on a DC.
After those test you may get the machine name (GetComputerName) and domain name (NetWkstaGetInfo) and whatever you need.
Be careful if you are doing this on a cluster.
I'm sure I'm missing something, but can't you use GetUserNameEx and pass in the desired EXTENDEND_NAME_FORMAT? I believe NameSamCompatible should be the format you desire.
You'll get back either MachineName\UserName or DomainName\UserName

Resources