Skip to content

Servers::rebuild

Danny Li edited this page Feb 4, 2018 · 1 revision

Rebuilds a server overwriting its disk with the content of an image, thereby destroying all data on the target server.

The image can either be one you have created earlier (backup or snapshot image) or it can be a completely fresh system image provided by Hetzner.

Your server will automatically be powered off before the rebuild command executes.

Parameters

Parameter Type Description
$id int Server ID
$image int/string/Image image ID, image name or Image object

Returns

ActionPasswordReset object

Example

<?php
use Exploriment\HetznerCloud;

$reset = HetznerCloud\Servers::rebuild(1, $image);

// returns the new root password
$password = $reset->getRootPassword();

/**
 * returns the Action object
 * @see https://github.com/Exploriment/hcloud-php/wiki/resources:-actions#action-object
 */
$action = $reset->getAction();

echo $action->getStatus();
Clone this wiki locally