loading a symbol into microsoft xp registry by remote logon server

C

cwnewbe1

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_MACHINE)
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",'\\\\Heimdall\\Firmware\\QA\\')
 
D

Dennis Lee Bieber

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...).


--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top