cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Trying to remotely send a command to Install BitWarden on a Machine (Not Working)

tsmith
Novitiate II

Hello JumpCloud Community!

I'm trying to make a command that installs Bitwarden on some of my machines remotely. I'm utilizing Chocolatey Package installer. I've made the script and it runs perfectly fine locally, but when I go into remote use of it, my if and else statement will always go to "Else" on a Remote command send. 

The following is my simple script:

$Chocolatey = {
    $testchoco = choco -v
    if(-not($testchoco)){
        Write-Host "Chocolatey is not installed, installing now..."
        Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
        Write-Host "Chocolatey has been installed."
    }
    else{
        Write-Host "Chocolatey Version " $testchoco " is already installed"
    }
}

$BitWarden = {
    $testbitwarden = Get-Package BitWarden -EA SilentlyContinue
    if($testbitwarden -eq $null){
        Write-Host "Bitwarden is not installed, installing now..."
        Choco install bitwarden -y
        Write-Host "Bitwarden has been installed."
    }
    else{
        Write-Host "Bitwarden has already been installed."
    }
}

Invoke-Command -ScriptBlock $Chocolatey
Invoke-Command -ScriptBlock $BitWarden
 
Any advice to get this working?
 
Thank you ๐Ÿ˜€
 
1 ACCEPTED SOLUTION

rlyons
Rising Star III

Okay, just throwing this out there, but why are you making a script at all, as it already exists in the Choco repos, so you can just add it directly in software management in JumpCloud?

It just works on all my Windows and Mac machines using JC's Software Management and Apple ABM> VPP.

View solution in original post

5 REPLIES 5

rlyons
Rising Star III

Okay, just throwing this out there, but why are you making a script at all, as it already exists in the Choco repos, so you can just add it directly in software management in JumpCloud?

It just works on all my Windows and Mac machines using JC's Software Management and Apple ABM> VPP.

Thanks for Replying, I did originally use Software Management, and the installation failed. So, I used the script as a backup. Due to me putting in the wrong package ID. I have now set it up with Software Management and with the correct installation package ID and JC shows it installed correctly. Unfortunately, I don't even see Bitwarden in the device under Control Panel > Programs. Any guidance as to why this is?

 

Thank you,

rlyons
Rising Star III

Not 100% sure on this, but I do know that often, when you uninstall software via chocolatey (or other PowerShell based options) the Windows Programs list doesn't update until the machine is restarted. I wonder if installation might be the same way.

I think this is more of an issue with Windows not reloading the registry on its own, than it is an actual issue with chocolatey.

So I did some digging, when I use the software management and add a pc to Bitwarden. Software Management gives me the "Install Successful" I go to look into Programs of that pc to see if it was installed no luck. I searched the directory and have noticed it's just downloading the installer in temp location. I thought it was supposed to just Install itself silently.

rlyons
Rising Star III

The installer downloads to a temp location, and it runs the installer from there. Once installed the installer isn't needed, so it's auto clean up. This is pretty normal. It shouldn't be actually installing in any temp locations though.

Sounds like there is some issue with chocolately calling the installer services to do the silent install after it downloads. I'm not quite sure where to go from here though.

I'm a bit more of a hands-on type that just works the problem; then being a walking KB. ๐Ÿ˜‰