Skip to content

Instantly share code, notes, and snippets.

@michaelcoyote
Last active August 29, 2015 14:05
Show Gist options
  • Save michaelcoyote/d6aa668dfb42f79a9193 to your computer and use it in GitHub Desktop.
Save michaelcoyote/d6aa668dfb42f79a9193 to your computer and use it in GitHub Desktop.
Old Perl script to add a list of clients to a NetWorker savegroup. Quick and dirty and could be massively improved.
#!/usr/bin/perl
#
# 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;
$NW_SERVER="networker-srv.example.com";
$BROWSE="NonProd-Index";
$RETENTION="NonProd-Retention";
$GROUP="NonProd-Clients";
$SAVESET="All";
#$SAVESET=\"c:\\\\\", "\"VSS SYSTEM FILESET:\\\\\", \"VSS SYSTEM BOOT:\\\\\",\"VSS SYSTEM SERVICES:\\\\\", \"VSS USER DATA:\\\\\",\"VSS OTHER:\\\\\", \"VSS ASR DISK:\\\\\";";
$COMMENT="Non-prod";
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: networker-sn01.example.com;\n";
print "recover storage nodes: networker-sn02.example.com;\n";
print "clone storage nodes: networker-sn02.example.com;\n" ;
#print "Proxy backup type: VCB;\n";
#print "Proxy backup host: bkprox.example.com;\n";
#print "aliases: $name.example.com $name.emea.example.com;\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