Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Local Profiles on workstations

Posted on 2006-06-06
3
Medium Priority
?
421 Views
Last Modified: 2008-01-09
Hello,
    Can anyone help me with a scripting question? I need a script than can be run remotely against a workstation that will enumerate (list) all of the local and domain profiles on a box as well as thier sizes. I am on a PC deployment and want to limit the number of profiles on these machines (many of which are shared) so that the tool I run to migrate data does not take hours copying over data from old profiles.

Thanks,
Mike E.
0
Comment
Question by:mikeeubank
1 Comment
 
LVL 23

Accepted Solution

by:
TheCleaner earned 2000 total points
ID: 16843864
They asked this on The Scripting Guy pages on MS.

http://www.microsoft.com/technet/scriptcenter/resources/qanda/jun05/hey0603.mspx

But as far as sizes goes, it doesn't do that...

however, I did find an old script that supposedly does it and creates an Access Database with the information.  I haven't ever used it so be cautious, but it may give you all that you are looking for:


=======================================================================================

'
' Title :          Customer Support Officer              
' Location :          Scottish Borders Council              
' Email Work :          ARobson@scotborders.gov.uk              
' Email Home :          robbo@blakehop.demon.co.uk              
'                                            
' Get the size of all users Profile & Home directories from the domain    
' and insert this info info an access database.                    
'                                              
' This script requires WSH,ADSI,VB5 Runtime and Loginbox activX tool    
' as well as Access97 to be installed on the PC the script is run from    
'                                            
'
'
' Version 1.1 Freeware
' Any Changes Must be reported to the Auther at his home Email address
'
'
' Access Database Structure
' Database Author: profiles.mdb
' Table Author: Domain_users
' Fields:     Author:               Type:    
' F1           UID               AutoNumber
' F2          UserName          Text:50
' F3          FullName          Text:50
' F4          Description          Text:150
' F5          LoginScript          Text:150
' F6          Profile               Text:150
' F7          Profile_Size          Number
' F8          HomeDirectory          Text:150
' F9          HomeDirectory_Size     Number
'
'*******************

' REMEMBER TO CHANGE THE DOMAIN NAME                          **
dim DomainName
DomainName = "greiernet"

'*******************


Dim oIADS, fsi, f
Dim fso, a
Dim objacc
Dim objdb
Dim rs
Dim objdbe
Dim MyCounter

' Setup Environment and Create objects ********

Set WSHSHELL = WScript.CreateObject("Wscript.Shell")
'Set LoginBox = WScript.CreateObject("Loginscreen.Main")
Set objacc = WScript.CreateObject("Access.Application")
Set objdbe = objacc.DBEngine
Set objdb = objdbe.OpenDatabase("c:\ftp\public\utilities\scripts\profilesize\profiles.mdb")
Set rs = objdb.OpenRecordset("domain_users")

' ** delete old records from database

strSQL = "delete * from domain_users"
set QDF = objdb.CreateQueryDef("",strSQL)
QDF.Execute
 
' ** setup user and file object ********
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile("c:\dirsize.csv")
Set fsi = CreateObject("Scripting.FileSystemObject")


' ** get NT domain info ***********
Set oIADS = GetObject("WinNT://" & DomainName)

On Error resume next

' **** setup dialog box to display ********

For Each oUser in oIADS
     if oUser.Class = "User" then
          MyCounter = MyCounter + 1
     end if    
next
Segments = 100 / MyCounter
'LoginBox.SetImage("d:\allan\Vbscript\downloads\homedir_report\sbc_logo.bmp")
loginbox.settitle("Scottish Borders Council")
LoginBox.SetWelcomeMessage("Scanning For User Profiles")
loginbox.setwaitmessage("Please Be Patient this may take a while")
LoginBox.Start

' **** get user info and add to database *********

For Each oUser in oIADS
 if oUser.Class = "User" then
     myseg = myseg + segments
     rs.addnew
     ' *** display text in dialog box ********    
     tx = oUser.name + VBCRLF
     tx = tx + oUser.fullname + VBCRLF
     tx = tx + oUser.description + vbcrlf
     tx = tx + oUser.loginscript + vbcrlf
     loginbox.setdisplaymessage(tx)
      ' *****************

     
     rs.fields("username").value = oUser.name
     rs.fields("Fullname").value = oUser.fullname
     rs.fields("description").value = oUser.description
     rs.fields("loginscript").value = oUser.loginscript
     
     if trim(oUser.profile) <> "" then
          Set f = fsi.GetFolder(oUser.profile)
          rs.fields("profile").value = oUser.profile
          rs.fields("Profile_size").value = CLng(f.size / 1024)
     else
          rs.fields("profile").value = "None"
          rs.fields("Profile_size").value = cLng("0")
     end if
         
     if trim(oUser.HomeDirectory) <> "" then
          Set g = fsi.GetFolder(oUser.HomeDirectory)
          rs.Fields("homedirectory").value = oUser.homedirectory
          rs.Fields("homedirectory_size").value = cLng(g.size / 1024)
     else
          rs.Fields("homedirectory").value = "None"
          rs.Fields("homedirectory_size").value = cLng("0")
     end if

     rs.update
     loginbox.pbar(Myseg)
 End If

Set f = Nothing
Next
loginbox.kill

set loginbox = nothing
set rs = nothing
set objdb = nothing

===============================================================================
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Batuhan Cetin In this article I will be guiding through the process of removing a failed DC metadata from Active Directory (hereafter, AD) using the ntdsutil tool in a Windows Server 2003 environment. These steps are not necessary in a Win…
On July 14th 2015, Windows Server 2003 will become End of Support, leaving hundreds of thousands of servers around the world that still run this 12 year old operating system vulnerable and potentially out of compliance in many organisations around t…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Enter Foreign and Special Characters Enter characters you can't find on a keyboard using its ASCII code ... and learn how to make a handy reference for yourself using Excel ~ Use these codes in any Windows application! ... whether it is a Micr…

572 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question