Saturday, July 17, 2010

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

13 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$

Post a Comment

Popular Posts

Share

Twitter Delicious Facebook Digg Stumbleupon Favorites More