Saturday, July 17, 2010

Home /AD /Microsoft /PowerShell /PowerShell Profile /script /Windows /Windows 7 / User Profile and Operating System (OS) Info – PowerShell Script

User Profile and Operating System (OS) Info – PowerShell Script

This script can be used to generate user profile and Operating System (OS) information from an input file (input.csv) which contains computer names.  This script generates 2 output files.  UserInfo.csv – which contains Computer Name, Profile Name, Last Access Time, OS version and Service Pack information. 

FailedCompuers.csv – Script verifies admin$ access. If the access fails, it will be added to the FailedComptuers.csv file.  This script also displays the output on the screen.

image

Console Output

image

Output File – UserInfo.CSV

image

Sample Input.CSV file

image

You can download the script from the following location:

UserProfile_OS_Info.PS1

SS

Santhosh Sivarajan

Microsoft MVP · Identity & Cybersecurity Architect

Santhosh has 30+ years of hands-on enterprise experience in Identity and Access Management, Microsoft Entra ID, Active Directory, Microsoft 365 and Zero Trust architecture. He is the author of two books on Windows Server and security, and leads consulting, assessments and training at SAG Business Group.

15 comments:

HI,

How do i get the full computer names to create the input file?

Any script for that?

Cosy

You can use DSQUERY command to get the computer name. Here is an example using DSQUERY * command:

dsquery * -limit 0 -filter "(&(ObjectClass=computer)(objectCategory=Computer))” –attr name >>input.csv

dsquery * -limit 0 -filter "(&(ObjectClass=computer)(objectCategory=Computer))” –attr name >>input.csv
dose not work ???

Why? Are you getting any error message? If so, please postt the error message here. Make sure you are using the correct "-" character before attr.

It is showing "can't access computer" error after running the script.

Can you access this computer? Do you have Admin privilege on this computer?

i am having "can't access computer".
I have an admin account which i am using to open the Script but i am facing the message above.

Note, i am running this script from my machine (Not Server), is that an issue !!?

is it possible to get the computer model information. like OptiPlex 740 to display in the output file?

Alaa Mahmoud,
That means you can’t access server. If firewall is turned on?
You can run it from anywhere

yes. You can add any hardware information.

Hi
Running as Administrator getting Can't Access, running from Windows 8 PC

i am having "can't access computer".
I have an admin account which i am using to open the Script but i am facing the message above

So modifyiing the code to reflect this will fox the "cant access computer" error

$profileaccess1 = Test-Path \\$Computer\c$
$profileaccess2 = Test-Path \\$Computer\c$

This script is designed to generate user profile and Operating System (OS) information from an input file called input.csv, which contains a list of computer names. When executed, the script produces two output files. The first one is UserInfo.csv, which includes details such as Computer Name, Profile Name, Last Access Time, OS version, and Service Pack information. This output file provides a comprehensive overview of user profiles and OS information for the specified computers. Additionally, I'd like to suggest playing Minecraft Pocket Edition Apk as a way to refresh your mind and enhance problem-solving abilities. Minecraft is an engaging and creative game that encourages critical thinking, strategizing, and creativity. It can provide a fun and immersive experience while also helping to improve cognitive skills. So, consider giving Minecraft a try to have an enjoyable and beneficial gaming experience!

Post a Comment

Popular Posts
Workstation Trust Relationship Issue Issue: You receive the following error message, when you try to login to the domain.  The security database on the server does not have ... ADMT Service Account - Permission and Configuration The ADMT service account needs to have proper permission in source and target domains.  You don’t need to use 2 separate accounts.  You can ... My First Peek into Microsoft Exchange 2010 By Santhosh Sivarajan Before I really dive into Exchange 2010, I thought I would install and play with it first. I took some screen shots and notes during the ins... ObjectSID and Active Directory What is an objectSID in Active Directory? When a new object is created in Active Directory, Domain Controller assigns a unique value used ... AD Group Report - List Group Members in Active Directory–PowerShell Script Updated Script - http://portal.sivarajan.com/2011/10/search-ad-collect-local-admin-group.html Script #1 This script... Add Users to a Group–PowerShell Script Purpose – Add users to a group from an input file – PowerShell V2 Script.  Input file – Input file (Users.csv) contains samAccountName in... User Account Migration and Merging – Part I (ADMT) Part I - User Account Migration and Merging Using ADMT Part II - User Account Migration and Merging Using QMM pre-creating user account ... User Account Migration and Merging – Part II (Quest Migration Manager) Part I - User Account Migration and Merging Using ADMT Part II - User Account Migration and Merging Using QMM Pre-creating user account in... Delete Stale or Inactive Computer Accounts from Active Directory Here is an easy way to identify and delete inactive or stale computers in an Active Directory environment.  Using the dsquery command you c... Converting PowerShell (PS1) to EXE / Standalone Application As we know, there many applications available to convert a PowerShell file to a standalone executable file.  Based on my experience, PowerSh...