Smaxey843's Profile User Rating: -----

Reputation: 8 Worker
Group:
Active Members
Active Posts:
74 (0.07 per day)
Joined:
22-November 11
Profile Views:
962
Last Active:
User is offline Feb 05 2013 08:55 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Who Cares
Favorite Gaming Platform:
PC
Your Car:
Who Cares
Dream Kudos:
0
Icon   Smaxey843 has not set their status

Posts I've Made

  1. In Topic: VBScript concatenation issue.

    Posted 3 Feb 2013

    Thank you Andrew. i'll plug that in when i have my test environment at work and report back.

    THanks again.
    Steven
  2. In Topic: Error : Type mismatch when referencing remote registry.

    Posted 27 Aug 2012

    Maj!
    Thats awesome! In previous hack and slashes through unknown territory I had read that very post about profiles! Thank you for your patience and after rereading the thread I realized i never clearly declared what I was trying to accomplish.

    I need to find out what the user path is for a user on a specified computer

    the issue with this is that during a migration. half of the network ID's were one convention and the other half another. The folks in charge of the migration took the easy route and did not recreate profiles that comply with their naming convention. So we have usernames of jsmith and the path could be %systemdrive%\documents and settings\smithj OR e01234

    So, the need to use the SID to determine a user's profile path on a remote computer was born. I got it to work, its an ugly little duck but it works to demonstrate the concept. whether or not to use this process will be decided beyond my pay grade. I need to get a rubber duck.

    code below incase this helps someone in the future :

    Option Explicit
    
    dim objWMIService, objRemoteWMIService, objWshNet, objFSO, objAccount, objShell, objReg, objSubkey
    dim strComputer, strRemoteComputer, strLIUser, strLIUserSID, strTargetuser, strLIDomain, strpartfilepath, strRegPartProfilePath, strRegProfilePath, strRegKeyPath, strValue, strRegKeyValueName,  strRegSubKeyPath
    dim intTest
    dim arrSubkeys
    
    Const HKEY_LOCAL_MACHINE = &H80000002
    
    'notify user that the script is executing
    Wscript.echo "Do not use this utility without the close attention of " & vbnewline &_
    "the assistance of HUSA/SUSA Technical support staff"
    
    'Step 1: Obtain currently logged on user's information.
    set objWshNet = WScript.CreateObject("WScript.Network")
    strLIUser = objWshNet.UserName
    strLIDomain = objWshNet.UserDomain
    strpartfilepath = "C:\documents and settings\"
    
    'Step 2: Using information gathered in step one, determine the SID of the user 
    strComputer = "." 
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set objAccount = objWMIService.Get _
        ("Win32_UserAccount.Name='" & strLIUser & "',Domain='" & strLIDomain & "'")
    strLIUserSID = objAccount.SID
    
    'Test Echo to display logged on domain user's SID
    Wscript.Echo "on computer : " & strComputer &vbnewline & "User : " & strLIUser & vbnewline & " SID : "& strLIUserSID 
    
    'Step 3: Query the user for the address of the old computer's IP Address.
    StrRemoteComputer = inputbox("What is your old computer's IP Address?", "Old PC IP Address")
    
    'Step 4: Connect to remote registry
    Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
    	strRemoteComputer & "\root\default:StdRegProv")
    
    'Initialize and define registry variables.
    strRegKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\" 
    strRegkeyValueName = "ProfileImagePath"
    strRegsubkeypath = strRegKeyPath & "\" & strLIUserSID
    
    'Step 5: Querty remote registry for specified keys, collect keys into array, search array for the specific keypath including currently logged on user's SID to find the user's path on that machine. 
    objreg.EnumKey HKEY_LOCAL_MACHINE,strRegKeyPath,ArrSubkeys
    objReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strRegsubKeyPath,strRegKeyValueName,strValue
    'Test Echo
    'wscript.echo " *** " &strRegSubKeypath &vbnewline & " *** " & strregkeyvaluename & vbnewline & " *** " & strValue
    	
    'Echo to report findings of this script.
    wscript.echo "in the case of "&strLIUser& " on " & strRemoteComputer & vbnewline &_
    	"The key path is : " & strRegKeyPath & vbnewline &_
    	"the key value name is : " & strRegKeyValueName & vbnewline &_
    	"the key value is : " & strValue
    
    wscript.echo "End of File"
    
    

My Information

Member Title:
D.I.C Head
Age:
28 years old
Birthday:
January 21, 1986
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Smaxey843 hasn't added any friends yet.

Comments

Smaxey843 has no profile comments yet. Why not say hello?