Jump to content

Feature Request: 'Add Host' In Other Areas


Recommended Posts

(Full Disclosure: We are running v8.1 (Build 8165), so not sure if below has been added in subsequent updates. Or if it exists and I've missed it.)


Feature Request:

We manage numerous hosts that cannot be captured by the various Host discovery options. As such, we have to manually add hosts a couple times per week. One of the issues is when we go to add an account, sometimes the Host record doesn't exist. In that case, we have to back out of the password screen and go into the Hosts > View All Hosts Records > Add Host. It would be extremely helpful if Passwordstate supported adding a Host from the Add New Password screen for users that have such permissions. Also, if the Hosts homepage could include an Add Hosts link as it is confusing for new users (and inefficient for established users) to have to go into the View All Hosts Records page before the Add Host option becomes available.


Thank you.

Link to comment
Share on other sites

Hi Geoff,


Thanks for your request and we'll see if we can come up with something for this. The main design issue I think we'll have is that we don't want one popup window on top of another i.e. Add Host screen on top of Add Password screen. Possibly we could just add the Host if not found based on what you type into the textbox, but there may be certain fields that need changing for the Host i.e. Operating System.

We'll have a think for what's possible here.


Click Studios

Link to comment
Share on other sites

  • 2 years later...
  • 1 month later...

We have internally build a workaround for this using the api as already mentioned by @Buckit. We are using Microsoft SCCM/MECM for deploying our windows servers. During OS Installation we connect to PasswordState, create the hosts entry based on data generated from the hosts system information and then create new local administrator accounts in passwordstate and adding this newly created host to these passwords. Also the newly created accounts in passwordstate will be used to create these accounts locally during os deployment.
We also check if the host already exists. (e.g. for a new installation of a server). Then the host is first deleted and then created again.

I have pulled out a small part of the scripts, maybe this helps you. The following few lines create a new PasswordState host based on some system information which is read automatically (The generation of the hostname or the primary IP address may not fit in your environment, but then you can simply adapt it for you). Tested with Windows Server 2016/2019.


Note: I use the Powershell module "PasswordState-Management" for this, as I am also one of the co-authors for it.


# Passwordstate Host URL
$PasswordManagerURL = 'https://passwordstate.local'
# Hosts Api Key found in the administration area - system settings - api
$HostsApiKey = ''

# Import needed powershell module
Import-Module PasswordState-Management

# Set Environment for Hosts Creation
Set-PasswordStateEnvironment -Uri $PasswordManagerURL -Apikey $HostsApiKey

# Collect System Data
$HostsData = @{
    HostName                   = [System.Net.DNS]::GetHostByAddress(([System.Net.DNS]::GetHostAddresses([System.Environment]::MachineName) | Where-Object { $_.AddressFamily -eq "InterNetwork" } | Select-Object IPAddressToString)[0].IPAddressToString).HostName.ToLower()
    HostType                   = "Windows"
    OperatingSystem            = (Get-CimInstance win32_operatingsystem).Caption.replace('Microsoft ', '')
    RemoteConnectionType       = "RDP"
    RemoteConnectionPortNumber = 3389
    Tag                        = "<insert your tag for adding new host to folder here>"
    #Title                      = [System.Net.DNS]::GetHostByAddress(([System.Net.DNS]::GetHostAddresses([System.Environment]::MachineName) | Where-Object { $_.AddressFamily -eq "InterNetwork" } | Select-Object IPAddressToString)[0].IPAddressToString).HostName.ToLower()
    Title                      = [System.Environment]::MachineName.ToLower()
    SiteID                     = 0
    InternalIP                 = ([System.Net.DNS]::GetHostAddresses([System.Environment]::MachineName) | Where-Object { $_.AddressFamily -eq "InterNetwork" } | Select-Object IPAddressToString)[0].IPAddressToString
    MacAddress                 = (Get-CimInstance win32_networkadapterconfiguration | Where-Object { $_.DefaultIPGateway -ne $null })[0].macaddress
    Notes                      = "Created: $('{0:yyyy-MM-dd HH:mm:ss}' -f (Get-Date))"
    SessionRecording           = $false
    VirtualMachine             = $true
    VirtualMachineType         = "VMware"

# Create Host based on given system data
$PasswordStateHost = New-PasswordStateHost @HostsData


Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...