I am using ActivePython 1.2 (Python = 2.4.3). Below is a copy of my source code. Any assistance will be appreciated.
import os, string, sys, win32con, _winreg
def createFolder(path):
if os.path.exists (path):
pass # do nothing
else:
os.mkdir(path)
def remoteSaveKey(host, subkey, file):
rhostreg = _winreg.ConnectRegistry(host, _winreg.HKEY_LOCAL_MACHINE)
remotekey = _winreg.OpenKey(rhostreg, subkey, 0, _winreg.KEY_ALL_ACCESS)
_winreg.SaveKey(remotekey, file)
destsrvr = "\\\\server1\\backup$\\"
# Registry key (and all subkeys) to be processed for backup/restore
regpath = "Software\\Cisco Systems, Inc."
# Open hostfile and read hostnames into a list
readfile = open('d:\scripts\dev\SideAsrv.txt', 'r')
hostfile = []
for host in readfile:
hostfile += [host.strip()]
readfile.close()
for srvname in hostfile:
outputpath = destsrvr + srvname
createFolder(outputpath)
outputfile = outputpath + "\\" + srvname
srvname = "\\\\" + srvname
# Call the function to connect to and export the remote registry key
output = remoteSaveKey(srvname, regpath, outputfile)
# DEBUG
print outputfile
# Select the next host
Thanks,
Rodney McBride
_______________________________________________ ActivePython mailing list ActivePython@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython