-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate_Proxy_backup_host.pl
32 lines (31 loc) · 1.18 KB
/
update_Proxy_backup_host.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/perl -w
# Update vcenter name in application group
# Purpose of utility is to find new clients and to move Windows clients into groups based
$nsrpass = ". type:NSR client'\n'show name\\;Proxy backup host'\n'print";
(@return) = `/usr/bin/echo $nsrpass | /usr/sbin/nsradmin -s sscprodeng -i -`;
foreach $record (@return) {
next if $record =~ /client/;
chomp $record;
$record =~ s/;$//;
if ($record =~ /^\s+name: /) {
$record =~ s/^\s+name: //;
$client = lc $record;
#print "Client=***$client***\n";
} elsif ($record =~ /^\s+Proxy backup host: /) {
$record =~ s/^\s+Proxy backup host: //;
if ($record =~ /^$/) {
print "proxy **$record** not set $client\n";
next;
} elsif ($record !~ /bkproxy/ ) {
print "Proxy set to **$record** on client $client\n";
#$nsrpass = "\. type: NSR client\\;name:$client'\n'update Proxy backup host: bkproxy'\n'";
#print "NSRPASS=$nsrpass\n";
#(@return) = `/usr/bin/echo $nsrpass | /usr/sbin/nsradmin -i - `;
#foreach $vvv (@return) {
# print "INFO: $vvv\n";
#}
} else {
print "$client=$record***\n";
}
}
}