By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,035 Members | 1,324 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,035 IT Pros & Developers. It's quick & easy.

loading a symbol into microsoft xp registry by remote logon server

P: n/a
I would like to be able to add environment symbols to the Microsoft XP
registry. I tried the example in the Python Cookbook by Orielly by
running the script locally and it worked fine. Although I noticed
that even though the symbol showed immediatedly in the registry by
viewing with regedit but not via a new dos command console, thus, I am
forced to reboot to make it 'lock in'. Is this normal?

My wish is to have the script invoked in the start-up script when a
person logs into a network, that, will populate the logging on
machines registry with the desired symbols. The Python.exe is on
another server (not the password verification server).

I do not want to place python.exe on every machine that needs symbols
loaded.

The symbols do not get loaded when I login to the network server.

The network machine is a Windows NT server.

First, in the logon script located on the network server I map a drive
to the server containing the python.exe
NET USE z: \\heimdall\

Then I next execute in the logon script the python script as:
z:\python_2.3.2\python.exe z:\QA\env.py

Do I need to use a drive letter mapping, or can I use a URL syntax in
NT?

Enclosed is the code I am executing in env.py, minus the imports:
What am I missing?
Can this be done?
Do I have correct priviledges in the logon script at this time?

# ************************************************** *
# Set a System Environment Symbol on a local machine
# c : a computers name \\theComputer
# k : the symbol key
# v : data payload of the symbol value
def setSystemRegistrySymbol(c,k,v):
print "Setting symbol on machine: " + c + " with symbol : " + k +
"=" + v
x = _winreg.ConnectRegistry(c,_winreg.HKEY_LOCAL_MACHI NE)
y = _winreg.OpenKey(x,
r"SYSTEM\CurrentCOntrolSet\Control\Session
Manager\Environment",
0,
_winreg.KEY_ALL_ACCESS)
_winreg.SetValueEx(y,k,0,_winreg.REG_EXPAND_SZ,v)

_winreg.CloseKey(x)
_winreg.CloseKey(y)

machine = r'\\myMachinesName'

setSystemRegistrySymbol(machine,"QA_BUILD",'\\\\He imdall\\Firmware\\QA\\')
Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 20 Feb 2004 07:06:51 -0800, CW******@YAHOO.COM (cw******@yahoo.com)
declaimed the following in comp.lang.python:
I would like to be able to add environment symbols to the Microsoft XP
registry. I tried the example in the Python Cookbook by Orielly by
running the script locally and it worked fine. Although I noticed
that even though the symbol showed immediatedly in the registry by
viewing with regedit but not via a new dos command console, thus, I am
forced to reboot to make it 'lock in'. Is this normal?
Reboot might be too severe... Depends... If you added to the
"user" environment variables, simply logging off and on will activate
them (and strangely, since you can program the log-off in Python, easier
than using "my computer/properties/advanced/environment variables" -- it
seems displaying that window, and okaying out, will activate them...).
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.