#!/bin/sh exec smbscript "$0" ${1+"$@"} /* tool to manipulate a remote registry Copyright Andrew Tridgell 2005 Released under the GNU GPL version 3 or later */ var options = GetOptions(ARGV, "POPT_AUTOHELP", "POPT_COMMON_SAMBA", "POPT_COMMON_CREDENTIALS", "createkey=s"); if (options == undefined) { println("Failed to parse options"); return -1; } libinclude("base.js"); libinclude("winreg.js"); if (options.ARGV.length < 1) { println("Usage: winreg.js [path]"); return -1; } var binding = options.ARGV[0]; reg = winregObj(); print("Connecting to " + binding + "\n"); status = reg.connect(binding); if (status.is_ok != true) { print("Failed to connect to " + binding + " - " + status.errstr + "\n"); return -1; } function list_values(path) { var list = reg.enum_values(path); var i; if (list == undefined) { return; } for (i=0;i 1) { root = options.ARGV[1]; } else { root = ''; } if (options.createkey) { var ok = reg.create_key("HKLM\\SOFTWARE", options.createkey); if (!ok) { println("Failed to create key"); } } else { printf("Listing registry tree '%s'\n", root); var count = list_path(root); if (count == 0) { println("No entries found"); return 1; } } return 0;