I'm trying to simply record a registry value (string) from the HKCU -
it works great if the user when they logon have local admin rights.
Only a few have this.


This is what I currently have stored in a batch file called out in our
logon script. Any suggestions on how to run/create this so that all
users negligent of having local admin or not succeed in running this?
Thanks

Mik
(If it was all in VBscript - better yet!)

echo %username% %userprofile% %date% %time% >>\\server1\share
\infofile.txt
Reg query "HKCU\software\VB And VBA Program Settings\ECOMETRY" /v Host
>>\\server1\share\infofile.txt
Reg query "HKCU\Software\VB And VBA Program Settings\ECOMETRY" /v Ver
>>\\server1\share\infofile.txt

Re: using logon script to record value from HKCU to text file.... by Corey

Corey
Mon Mar 03 07:12:52 CST 2008

You shouldn't need admin rights to read/write to HKCU as the current
user. In VBScript, it's pretty easy.

Link for reading the registry: http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true

Link for writing to a file: http://www.microsoft.com/technet/scriptcenter/scripts/default.mspx?mfr=true


If you need help, let us know!

-Corey Thomas

On Mar 3, 2:14 am, Mik <mi...@onlineshoes.com> wrote:
> I'm trying to simply record a registry value (string) from the HKCU -
> it works great if the user when they logon have local admin rights.
> Only a few have this.
>
> This is what I currently have stored in a batch file called out in our
> logon script. Any suggestions on how to run/create this so that all
> users negligent of having local admin or not succeed in running this?
> Thanks
>
> Mik
> (If it was all in VBscript - better yet!)
>
> echo %username% %userprofile% %date% %time% >>\\server1\share
> \infofile.txt
> Reg query "HKCU\software\VB And VBA Program Settings\ECOMETRY" /v Host>>\\server1\share\infofile.txt
>
> Reg query "HKCU\Software\VB And VBA Program Settings\ECOMETRY" /v Ver
>
> >>\\server1\share\infofile.txt


Re: using logon script to record value from HKCU to text file.... by Mik

Mik
Wed Mar 05 23:46:23 CST 2008

On Mar 3, 5:12=A0am, Corey Thomas <coreytho...@gmail.com> wrote:
> You shouldn't need admin rights to read/write to HKCU as the current
> user. =A0InVBScript, it's pretty easy.
>
> Link for reading the registry: =A0http://www.microsoft.com/technet/scriptc=
enter/scripts/default.mspx?mf...
>
> Link for writing to a file:http://www.microsoft.com/technet/scriptcenter/s=
cripts/default.mspx?mf...
>
> If you need help, let us know!
>
> -Corey Thomas
>
> On Mar 3, 2:14 am,Mik<mi...@onlineshoes.com> wrote:
>
>
>
> > I'm trying to simply record a registry value (string) from the HKCU -
> > it works great if the user when they logon have local admin rights.
> > Only a few have this.
>
> > This is what I currently have stored in a batch file called out in our
> > logon script. =A0Any suggestions on how to run/create this so that all
> > users negligent of having local admin or not succeed in running this?
> > Thanks
>
> >Mik
> > (If it was all inVBscript-betteryet!)
>
> > echo %username% %userprofile% %date% %time% >>\\server1\share
> > \infofile.txt
> > Reg query "HKCU\software\VB And VBA Program Settings\ECOMETRY" /v Host>>=
\\server1\share\infofile.txt
>
> > Reg query "HKCU\Software\VB And VBA Program Settings\ECOMETRY" /v Ver
>
> > >>\\server1\share\infofile.txt- Hide quoted text -
>
> - Show quoted text -

Hi Corey,
Thanks for the references... Can you explain this code?

Set oReg=3DGetObject("winmgmts:{impersonationLevel=3Dimpersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

I believe this line is what allows me to capture the HKCU string
values that I was looking for - but couldn't do with the logon script
listed above. What is the "impersonation?

Mik