Skip to content
Snippets Groups Projects
Commit 346b8753 authored by Jonas Leder's avatar Jonas Leder
Browse files

add install instructions

parent 412244a9
Branches
No related tags found
No related merge requests found
Pipeline #41883 passed
......@@ -7,3 +7,7 @@ This is a Cloud-Init Agent for Windows. It's used to deploy VServer at [Realtoxm
- Password
As windows needs the password in Cleartext, it cannot be set directly from the Cloud-Init configuration. We implemented a special IP, which compares the hashed password ( which is provided via Cloud-Init ), with the unencrypted password, saved in WHMCS. The Password can be found [here](https://git.itbyhf.xyz/ha/windows-cloudinit-pwapi)
## Installation
There is a script called `install.ps1`. Copy this script to the VM and execute it using powershell. It will download the latest version and register the service. After installing place the `config.json` in the `C:\Cloud-Init` folder. Now the image is prepared and you can reset it to the OOBE mode with the unattend.xml file and the following command: `C:\Windows\system32\sysprep\sysprep.exe /generalize /oobe /shutdown /unattend:"C:\Cloud-Init\unattend.xml"`
\ No newline at end of file
$cloudinitUrl = "https://s3.jonasled.de/share/cloudinit-windows-amd64.exe"
$nssmUrl = "https://nssm.cc/release/nssm-2.24.zip"
$workDir = 'C:\Cloud-Init'
$cloudInitTargetPath = "$workDir\cloud-init.exe"
$nssmTargetPath = "$workDir\nssm.zip"
$nssmPath = "$workDir\nssm-2.24\win64\nssm.exe"
$serviceName = "Cloud-Init"
New-Item -Path "c:\" -Name "Cloud-Init" -ItemType "directory"
Write-Host "Downloading Cloud-Init..."
$ProgressPreference = 'SilentlyContinue'
Invoke-WebRequest -Uri $cloudinitUrl -OutFile $cloudInitTargetPath
Write-Host "Downloading NSSM..."
Invoke-WebRequest -Uri $nssmUrl -OutFile $nssmTargetPath
Expand-Archive -LiteralPath $nssmTargetPath -DestinationPath $workDir
Remove-Item $nssmTargetPath
Start-Process -FilePath $nssmPath -ArgumentList "install $serviceName $cloudInitTargetPath" -NoNewWindow -Wait
Start-Process -FilePath $nssmPath -ArgumentList "set $serviceName AppDirectory $workDir" -NoNewWindow -Wait
Start-Process -FilePath $nssmPath -ArgumentList "set $serviceName Start SERVICE_AUTO_START" -NoNewWindow -Wait
Start-Process -FilePath $nssmPath -ArgumentList "set $serviceName AppExit Default Ignore" -NoNewWindow -Wait
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment