Created
August 5, 2016 15:48
-
-
Save spuder/d5a19a300de81146c4e9474e211a18d9 to your computer and use it in GitHub Desktop.
Check if octopus deploy tentacle is registered with server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Powershell script to see if an octopus deploy tentacle is registered with an octopus deploy server | |
# Returns true if node is 'not' registered | |
# Replace 'http://octopus.example.com' and '1234578910' with your server and octopus deploy api key | |
Add-Type -Path '.\\Newtonsoft.Json.dll' | |
Add-Type -Path '.\\Octopus.Client.dll' | |
$endpoint = new-object Octopus.Client.OctopusServerEndpoint 'http://octopus.example.com', '12345678910' | |
$repository = new-object Octopus.Client.OctopusRepository $endpoint | |
$tentacle = New-Object Octopus.Client.Model.MachineResource | |
$thumbprint = (& '.\\Tentacle.exe' show-thumbprint --nologo --console) | |
$thumbprint = $thumbprint -replace '.*([A-Z0-9]{40}).*', '$1' | |
[string]::IsNullOrEmpty($thumbprint) -OR $repository.Machines.FindByThumbprint($thumbprint).Thumbprint -ne $thumbprint |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment