| Server IP : 180.180.241.3 / Your IP : 216.73.216.216 Web Server : Microsoft-IIS/7.5 System : Windows NT NETWORK-NHRC 6.1 build 7601 (Windows Server 2008 R2 Standard Edition Service Pack 1) i586 User : IUSR ( 0) PHP Version : 5.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Program Files/CA/arcserve Unified Data Protection/Engine/BIN/Appliance/ |
Upload File : |
$arcrunpath = $(split-path $myinvocation.invocationname -parent)
cd $arcrunpath
$DHCPdoneFlagFile = "dhcpdone.flag";
$Type = "Win32_NetworkAdapterConfiguration"
$ExcludeIP = "192.168.10.1"
$ScopeId = "192.168.10.0"
$VMIp = "192.168.10.2"
$NATVMName = "Linux-BackupSvr";
$DNSSuffixArray = @();
$DNSServerArray = @();
$DNSSuffixsStr="";
$HostDNSnamesStr="";
$TotalTime2Wait = 0;
$DHCPReady = $false;
while ($TotalTime2Wait -lt 300)
{
if (Test-Path $DHCPdoneFlagFile -PathType Leaf){
$DHCPReady = $true;
Write-Host 'DHCP Server is ready';
break;
}
Start-Sleep -s 2;
$TotalTime2Wait = $TotalTime2Wait + 2;
}
if ($DHCPReady -ne $true){
Write-Host 'DHCP Server is not ready';
return;
}
#################################Set NAT#####################################################
.\setnat.ps1
#################################Set DNS#####################################################
Start-Sleep -s 6
$LinuxVM = Get-VM -Name $NATVMName
$NICDisconnected = $false;
if ($LinuxVM.State -eq "Running"){
Get-VMNetworkAdapter -VMName $NATVMName | Disconnect-VMNetworkAdapter;
$NICDisconnected = $true;
}
$AdapterSet = gwmi $Type | Where-Object {$_.IPEnabled -eq 'True'}
Foreach ($Class in $AdapterSet){
$bValidNic=$true;
Foreach ($IP in $Class.IPAddress){
if ($IP -eq $ExcludeIP){
$bValidNic = $false;
break;
}
}
if ($bValidNic -ne $true)
{
continue;
}
Foreach ($DNSSuffux in $Class.DNSDomainSuffixSearchOrder){
$bExist = $false;
Foreach($ExistedDNSSuffix in $DNSSuffixArray){
if ($DNSSuffux -eq $ExistedDNSSuffix)
{
$bExist = $true;
break;
}
}
if ($bExist -ne $true){
$DNSSuffixArray += @($DNSSuffux);
if ($DNSSuffixsStr -ne ''){
$DNSSuffixsStr += ' ';
}
$DNSSuffixsStr += $DNSSuffux;
if ($HostDNSnamesStr -ne '')
{
$HostDNSnamesStr += ' ';
}
$HostDNSnamesStr += $Class.DNSHostName + '.' + $DNSSuffux;
}
}
Foreach ($DNSServer in $Class.DNSServerSearchOrder){
$bExist = $false;
Foreach($ExistedDNS in $DNSServerArray){
if ($DNSServer -eq $ExistedDNS)
{
$bExist = $true;
break;
}
}
if ($bExist -ne $true){
$DNSServerArray += @($DNSServer);
}
}
}
$ComputerSystem = gwmi win32_computersystem;
if ($($DNSSuffixArray.Count) -gt 0){
if ($ComputerSystem.PartOfDomain -eq $true){
try{
add-dhcpserverindc;
}catch{
write-host "This machine is part of a domain and the DHCP server failed to be authorized. Please contact your domain administrator to authorize the DHCP server before using the Arcserve UDP Linux Backup server." -foregroundcolor red -backgroundcolor yellow
#pause;
}
}
Write-Host 'HostDnsName:'$HostDNSnamesStr
Write-Host 'DNSSuffixSearchOrder:'$DNSSuffixsStr
Set-DhcpServerv4OptionValue -ScopeId $ScopeId -DnsDomain $DNSSuffixsStr
}
if ($($DNSServerArray.Count) -gt 0)
{
Write-Host 'DNSServerSearchorder: '$DNSServerArray;
Set-DhcpServerv4OptionValue -ScopeId $ScopeId -DnsServer $DNSServerArray
}
if ($NICDisconnected -eq $true){
Start-Sleep -s 2
Get-VMSwitch –SwitchType 'Internal' | Connect-VMNetworkAdapter -VMName $NATVMName
}
netsh interface portproxy add v4tov4 listenport=8018 connectaddress=$VMIp connectport=8014 protocol=tcp;
netsh interface portproxy add v4tov4 listenport=8019 connectaddress=$VMIp connectport=22 protocol=tcp;