Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Info

CyberCNS Lightweight Agent Installation Script for Windows.

Code Block
$serviceName = '*cybercns*'

  
if (!$env:cybercnscompanyid)

{

    return


{
    return "$env:cybercnscompanyid is NULL"

}


if (!$env:cybercnsclientid)

{

    return


{
    return "$env:cybercnsclientid is NULL"


}


if (!$env:cybercnsclientsecret)

{

    return


{
    return "$env:cybercnsclientsecret is NULL"


}


if (!$env:cybercnsdomain)

{

    return


{
    return "$env:cybercnsdomain is NULL"

}

If



}


If (Get-Service $serviceName -ErrorAction SilentlyContinue)
{    If
 {

    If ((Get-Service $serviceName).Status -eq 'Running')
{

        return "$serviceName found and running."

    } Else {

        return "$serviceName found, but it is not running."

    }

} Else {

    Write-Host "Downloading

 {

        return "$serviceName found and running."


    } Else { 
          
        return "$serviceName found, but it is not running."
          
    }    
        
} Else {
    Write-Host "Downloading https://cybercnsagent.s3.amazonaws.com/cybercnsagent.exe"
    $source =

    $source = 'https://cybercnsagent.s3.amazonaws.com/cybercnsagent.exe'
    $destination =

    $destination = 'cybercnsagent.exe'
   

    Invoke-WebRequest -Uri $source -OutFile
$destination   
 $destination
    ./cybercnsagent.exe -c $env:cybercnscompanyid -a $env:cybercnsclientid -s $env:cybercnsclientsecret -b $env:cybercnsdomain -i LightWeight
}  
Info

CyberCNS Probe Agent Installation Script for Windows

Code Block
$serviceName = '*cybercns*'
  
if (!$env:cybercnscompanyid)
{
    return "$env:cybercnscompanyid is NULL"
}

if (!$env:cybercnsclientid)
{
    return "$env:cybercnsclientid is NULL"

}

if (!$env:cybercnsclientsecret)
{
    return "$env:cybercnsclientsecret is NULL"

}

if (!$env:cybercnsdomain)
{
    return "$env:cybercnsdomain is NULL"

}


If (Get-Service $serviceName -ErrorAction SilentlyContinue) {

    If ((Get-Service $serviceName).Status -eq 'Running') {

        return "$serviceName found and running."


    } Else {

        return "$serviceName found, but it is not running."

    }

} Else {
    Write-Host "Downloading https://cybercnsagent.s3.amazonaws.com/cybercnsagent.exe"
    $source = 'https://cybercnsagent.s3.amazonaws.com/cybercnsagent.exe'
    $destination = 'cybercnsagent.exe'
    Invoke-WebRequest -Uri $source -OutFile $destination
    ./cybercnsagent.exe -c $env:cybercnscompanyid -a $env:cybercnsclientid -s $env:cybercnsclientsecret -b $env:cybercnsdomain -i Probe
}