Warning: file_exists(): open_basedir restriction in effect. File(/bin/bash) is not within the allowed path(s): (/var/www/clients/client0/web58/web:/var/www/clients/client0/web58/private:/var/www/clients/client0/web58/tmp:/var/www/testwiki.znil.net/web:/srv/www/testwiki.znil.net/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom;/gitinfo) in /var/www/clients/client0/web58/web/includes/shell/CommandFactory.php on line 119

Warning: file_exists(): open_basedir restriction in effect. File(/bin/bash) is not within the allowed path(s): (/var/www/clients/client0/web58/web:/var/www/clients/client0/web58/private:/var/www/clients/client0/web58/tmp:/var/www/testwiki.znil.net/web:/srv/www/testwiki.znil.net/web:/usr/share/php5:/usr/share/php:/tmp:/usr/share/phpmyadmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/dev/random:/dev/urandom;/gitinfo) in /var/www/clients/client0/web58/web/includes/shell/CommandFactory.php on line 119

Deprecated: Use of MediaWiki\Parser\ParserOutput::addJsConfigVars was deprecated in MediaWiki 1.38. [Called from DisplayComments::getParserHandler in /var/www/clients/client0/web58/web/extensions/Comments/includes/parser/DisplayComments.php at line 29] in /var/www/clients/client0/web58/web/includes/debug/MWDebug.php on line 385
PowerShell DHCP-Reservierungen kopieren – testznilwiki
 Aktionen

PowerShell DHCP-Reservierungen kopieren

Aus testznilwiki

foreach ($reservation in Get-DhcpServerv4Reservation -ScopeId 192.168.2.0 -ComputerName QUELL-DHCP)
{
    Write-Host IP: $reservation.IPaddress - CientID: $reservation.ClientId - Name: $reservation.Name
    Add-DhcpServerv4Reservation -ComputerName ZIEL-DHCP-Type DHCP -IPAddress $reservation.IPaddress -ClientId $reservation.ClientId -Name $reservation.Name -ScopeId 192.168.2.0
    Write-Host IP: $reservation.IPaddress                                  
}

Im Quelltext folgendes anpassen:

  • 192.168.2.0 durch euren Adressbereich / DHCP-bereich
  • QUELL-DHCP durch den Namens des Servers von dem kopiert werden soll
  • ZIEL-DHCP mit den Namen des Servers zu dem die Reservierungen kopiert werden soll


Und so kopiert man die aktiven Leases:

foreach ($lease in Get-DhcpServerv4Lease -ScopeId 192.168.2.0 -ComputerName QUELL-DHCP)
{
    Write-Host IP: $lease.IPaddress - CientID: $lease.ClientId - Name: $lease.HostName - AddressState $lease.AddressState
    # Add-DhcpServerv4lease -ComputerName ZIEL-DHCP -Type DHCP -IPAddress $lease.IPaddress -ClientId $lease.ClientId -Name $lease.Name -ScopeId 192.168.2.0
    if ( $lease.AddressState -ne "InactiveReservation" ) {
        Add-DhcpServerv4Lease -ClientId $lease.ClientId -IPAddress $lease.IPaddress -ScopeId 192.168.2.0 -AddressState $lease.AddressState
    }
    Write-Host IP: $lease.IPaddress
}

Auch wenn da mal eine Fehlermeldung kommt ... sollte es für den Rest funktionieren


Kommentare

Loading comments...