Hi, Can i get below details for local or AD users in below csv format , please share a script for windows Application/service Host Name User Privilege Account Type
Yet, note, these items...
Application/service Host Name User Privilege Account Type
... are not all in AD
Application / Service can be computer specificPrivilege can be AD and computer and UNC specific.
So, you need to better define what you are after and go at it one section / step at a time.
This query indicates the either you are new to PowerShell, or new to PowerShell and AD or both. Yet, what you are asking for is basic PowerShell 100 level stuff. A quick look at the no cost PowerShell course on Microsoft Virtual Academy will get you going or a quick look on YouTube, will do the same. Just search for beginning PowerShell.
You don't have to struggle at trying o write this from scratch if you are. There are tons of samples all over the web on how to do this.
This forum, and other like it, are not free a code writing service(s). We are here to help you with code you've written that is not working or that you are confused on. Yet, you have to show your work.
Again, there are tons of samples on the web for this, but never run code you get from anyone that you don't understand.
Secondly, Windows Server GUI can write this code for you. You just use the Windows Server ADAC (Active Directory Administrative Center)...
Introduction to Active Directory Administrative Center Enhancements (Level 100)'docs.microsoft.com/en-us/windows-server/identity/ad-ds/get-started/adac/introduction-to-active-directory-administrative-center-enhancements--level-100-'
Step-By-Step: Utilizing PowerShell History Viewer in Windows Server 2012 R2'blogs.technet.microsoft.com/canitpro/2015/03/04/step-by-step-utilizing-powershell-history-viewer-in-windows-server-2012-r2'
Use Active Directory Administrative Center to Create PowerShell Commands in Windows Server 2012'petri.com/use-active-directory-administrative-center-create-powershell-commands'
...click thru what you want to get the data set, then copy and paste into any PowerShell script editor (the built in PowerShell_ISE.exe or download and use Visual Studio Code code.visualstudio.com) and tweak as needed.
You can also, look through the 'powershellgallery.com' web site and search for active directory to find samples.
Example:Powershell Script to export Active Directory users to CSV does exactly what it says:
Exports Active Directory users to CSV
Customize the script exactly how you want it. This might help you determine users with missing fields like office, email address and more.'gallery.technet.microsoft.com/scriptcenter/Powershell-script-to-5edcdaea'
You can also look directly at the PowerShell built-in help system to find samples. Yet, to look at the AD cmdlets, you have to be on the domain controller (local or remote) or install the RSAT tools on your local workstation to get the help for them or go to the MS online help for PowerSHell AD cmdlets.
Thanks .. for the descriptive response