Server IP : 180.180.241.3 / Your IP : 216.73.216.252 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 : |
#$debugpreference="Continue" start-transcript -path $($MyInvocation.MyCommand.Name+".log") -force |out-null $doneflag = ".\dhcpdone.flag" $vmstartedflag = ".\vmstarted.flag" $dnsdone = $false if (!(test-path $doneflag)){ write-debug "$doneflag file does not exist" $arcrunpath = $(split-path $myinvocation.invocationname -parent)+"\arcrun.bat" ## new-itemproperty -path hklm:\software\microsoft\windows\currentversion\run -name arcenv -value $arcrunpath -force ######################### setup dhcp $vs = get-vmswitch -switchtype internal if($vs.count -eq 0) {throw "cannot locate the Hyper-v virtual network adapter"} write-debug "located the internal virtual switch" $vnic = get-vmnetworkadapter -name $vs.name -managementos if($vnic.count -eq 0) {throw "cannot locate the vnic"} write-debug "located the virtual nic for internal virtual switch" gwmi Win32_NetworkAdapterConfiguration| Where-Object {$_.IPEnabled -eq 'True'} |foreach-object{if($($_.macaddress).replace(":","") -eq $vnic.macaddress){$maddr = $_.macaddress}} $prinic = gwmi Win32_NetworkAdapterConfiguration| Where-Object {$_.IPEnabled -eq 'True'} | where-object{$_.macaddress -eq $maddr} $priipexist = $false $prinic.ipaddress | foreach-object{if($_ -match "192.168.10.1"){$priipexist = $true}} write-host "Starting checking domain admin account" if($(gwmi win32_computersystem).partofdomain){ write-debug "This computer is part of domain" 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 "192.168.10.1 existence: $priipexist" if($priipexist -eq $false){ write-host "private static ip lost. reassigning..." new-netipaddress -interfaceindex $prinic.interfaceindex -ipaddress 192.168.10.1 -prefixlength 24 sleep 1 } if(!$(get-dhcpserverv4binding | where-object{$_.ipaddress -match "192.168.10.1"}).bindingstate){ write-host "dhcp server nic binding lost. rebinding..."; $namepri= $(gwmi Win32_NetworkAdapter| Where-Object {$_.macaddress -match $maddr}).NetConnectionID sleep 1 set-dhcpserverv4binding -bindingstate $true -interfacealias $namepri } #make sure scope exists if($(get-dhcpserverv4scope).count -eq 0){ write-host "dhcp server scope lost. recreating..." add-dhcpserverv4scope -startrange 192.168.10.2 -endrange 192.168.10.2 -subnetmask 255.255.255.0 -name nat -state active set-dhcpserverv4optionvalue -scopeid 192.168.10.0 -optionid 3 -value 192.168.10.1 } #create done flag write-debug "creating the dhcpdone flag" new-item -name $doneflag -force -itemtype file |out-null write-host "Setting up DNS ..." .\setdns.ps1 $dnsdone=$true if (!(test-path $vmstartedflag)){ write-debug "vmstartedflag was not found. vm has not been started ever. restarting it." if((get-vm linux-backupsvr).state -notmatch "off"){write-host "Stopping VM...";stop-vm Linux-BackupSvr -force} write-host "Starting VM..."; start-vm Linux-BackupSvr sleep 2 write-debug "creating vmstartedflag file" new-item -name $vmstartedflag -force -itemtype file #### the RAS workaround remove-dhcpserverv4lease -scopeid 192.168.10.0 -confirm:$false } } #################### setup DNS if(!$dnsdone){write-host "Setting up DNS ...";.\setdns.ps1} stop-transcript exit