Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Old Perl script to add a list of clients to a NetWorker savegroup. Quick and dirty and could be massively improved.
# Takes filename as argument.
# file should contain clientnames one to a line non qualified
# todo:
# do initial probe after adding client
# prompt for client resourcevalues
# good practice
#use strict;
use File::Path;
#use warnings;
#$SAVESET=\"c:\\\\\", "\"VSS SYSTEM FILESET:\\\\\", \"VSS SYSTEM BOOT:\\\\\",\"VSS SYSTEM SERVICES:\\\\\", \"VSS USER DATA:\\\\\",\"VSS OTHER:\\\\\", \"VSS ASR DISK:\\\\\";";
open (HOSTS, "$ARGV[0]");
@hosts = <HOSTS>;
foreach $hosts (@hosts) {
chomp ($hosts);
($hn,$vs) = split (',',$hosts);
$hn =~ tr/[A-Z]/[a-z]/;
#open( NSRADM, "|nsradmin -s $NW_ADMIN ");
print "create type: NSR client;\n";
#print "name: $name;\n";
print "name: $hn;\n";
print "comment: $COMMENT;\n";
print "archive services: Disabled;\n";
print "browse policy: $BROWSE;\n";
print "retention policy: $RETENTION;\n";
print "group: $GROUP;\n";
print "save set: $SAVESET;\n";
if ($vs) {print "virtual client: Yes;\n"};
if ($vs) { print "physical host: $vs ;\n"};
print "storage nodes:;\n";
print "recover storage nodes:;\n";
print "clone storage nodes:;\n" ;
#print "Proxy backup type: VCB;\n";
#print "Proxy backup host:;\n";
#print "aliases: $ $;\n";
print "\ny\n\n"
#close (NSRADM);
close HOSTS;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment