[THIN] Re: Mass edit on TS users HKCU

  • From: "Braebaum, Neil" <Neil.Braebaum@xxxxxxxxxxxxxxxxx>
  • To: <thin@xxxxxxxxxxxxx>
  • Date: Thu, 17 Feb 2005 09:34:59 -0000

You can't just hope to expand environment variables like that in
vbscript / WSH. If you want to access environment variables using
vbscript / WSH you have to use the environment property of the wshshell
object. So you'd need something like:-

Dim objEnv,objWSHShell
Dim strUserName

set objWSHShell=createobject("wscript.shell")
set objEnv=objWSHShell.environment("process")

strUserName=objEnv("USERNAME")

set objEnv=nothing
set objWSHShell

The username is also available via the WSHNetwork object, as is the
current logon domain, plus a whole host of other network-y / domain-y
type properties.

One other thing I'd suggest - given that you appear new to vbscripting,
is that if you're planning on doing a fair bit in login scripts - ie
copying files, mapping drives, writing to the registry - you're going to
find it difficult and hampered using vbscript / WSH. Writing to the
registry is quite limited using WSH functionality. You can do more with
WMI scripting for the registry, but it's a degree more complex.

For typical login scripts, I think you'll find something like Kixtart
far more optimal, mapping drives, copying files and writing to the
registry is far easier - and as you appear to be learning vbscript /
WSH, you don't appear to have anything to lose.

For system admin functions and domain management, vbscript / ADSI / WSH
is spot on, but for login scripts, it's quite unwieldy compared with
something much more suitable like Kixtart.

Neil

> -----Original Message-----
> From: thin-bounce@xxxxxxxxxxxxx 
> [mailto:thin-bounce@xxxxxxxxxxxxx] On Behalf Of Ron Jameson
> Sent: 17 February 2005 02:52
> To: thin@xxxxxxxxxxxxx
> Subject: [THIN] Mass edit on TS users HKCU
> 
> 
> Anybody familiar with mass edits in a terminal server 
> registry for the HKCU (which ends up being HK Users the the 
> SID)?  I am trying to adjust/tweak each users registry 
> setting via the login VBS script but cannot find a way to 
> pass the username variable into the script while using the 
> wshell.regwrite method.
> 
> Example:  
> 
> Sub RegistryChanges
> 
> Dim wshshell
> Set wshshell = WScript.CreateObject("WScript.Shell")
> 
> wshshell.regwrite "HKCU\Software\XYZ 
> Corp\ProgramName\CategoryBurnImageLocation", "C:\Documents 
> and Settings\%USERNAME%\Application Data\XYZ Corp\ProgramFolder"
> 
> End Sub
> 
> 
> I need to alter the path variable to match the users login 
> name...but the %username% is not passing to the registry when 
> I test it.
> 
> Any clues?


*****************************************************************************
This e-mail and its attachments are confidential and are intended for the above 
named recipient only. If this has come to you in error, please notify the 
sender immediately and delete this e-mail from your system. You must take no 
action based on this, nor must you copy or disclose it or any part of its 
contents to any person or organisation. Statements and opinions contained in 
this email may not necessarily represent those of Littlewoods. Please note that 
e-mail communications may be monitored. The registered office of Littlewoods 
Limited and it's subsidiaries is 100 Old Hall Street, Liverpool, L70 1AB. 
Registered number of Littlewoods Limited is 262152.
*****************************************************************************




This message has been scanned for viruses by BlackSpider MailControl - 
www.blackspider.com
********************************************************
This Weeks Sponsor: RTO Software TScale
TScale provides a cost-effective way to improve performance, capacity and 
stability for thin-client servers like Citrix MetaFrame or Microsoft Terminal 
Services running Windows NT, 2000 or 2003.
http://www.rtosoft.com/enter.asp?id)6
**********************************************************
Useful Thin Client Computing Links are available at:
http://thin.net/links.cfm
ThinWiki community - Excellent SBC Search Capabilities!
http://www.thinwiki.com
***********************************************************
For Archives, to Unsubscribe, Subscribe or
set Digest or Vacation mode use the below link:
http://thin.net/citrixlist.cfm

Other related posts: