Vous êtes sur la page 1sur 2

Command Line

Install Nvivo 11 as mentioned on the support site:


http://techcenter.qsrinternational.com/desktop/nv11/nv11_unattended_command_line_in
stallation.htm

After installing use the script below to activate the product, dont forget to
create the Registration.XML as specified by the vendor.

The reason we are using this script to activate/deactivate is because the Nvivo.exe
always returns 0, even on activate/deactivate failure. This script pipes the output
to a variable and checks for success strings.

The script will exit with errorcode 1 if it fails.

The machine needs a working internet connection to activate!

Please check the output of the activation output from Nvivo.exe, if the vendor
changes the string output, then this will fail to work.

<#
.SYNOPSIS
This will activate and deactivate Nvivio 11 with detection methods to ensure
the action has
been completed correctly.

.LINK
Author:.......http://www.linkedin.com/in/rileylim

.EXAMPLE
To activate Nvivo.
PowerShell.exe -ExecutionPolicy ByPass -File Manage-NvivoLicence.ps1

.EXAMPLE
To deactivate Nvivo.
PowerShell.exe -ExecutionPolicy ByPass -File Manage-NvivoLicence.ps1 -Remove
#>

Param([Switch]$Remove)
$DebugPreference = 'SilentlyContinue' #SilentlyContinue|Continue
$warningpreference = 'SilentlyContinue' #SilentlyContinue|Continue
$WaitTimer = 7 #In secounds, will wait until trying again
$MaxAttempts = 5 #Max tries until failing with error code 1
$Count = $null #If testing manually this will flash $Count

$Nvivo = "$env:ProgramFiles\QSR\NVivo 11\NVivo.exe" #Chnage this to where the


Nvivo exe is located
$Licence = 'NVT11-00000-00000-00000-00000' #Nvivo product key/licence

If ($Remove -eq $true)


{$Count = $null
Write-Debug 'Removing licence.'
Do {$String = & $Nvivo -deactivate | Out-String
$BreakOut = $String.Contains('No activated license key exists to
deactivate.')
Write-Debug "Removing licence `$String value is: $String"
Write-Debug "Removing licence `$BreakOut value is: $BreakOut"
Start-Sleep $WaitTimer
$Count = $Count + 1
Write-Debug "The `$Counter vlue is: $Count"
If ($Count -eq $MaxAttempts)
{Write-Debug "The `$Count has reached `$MaxAttempts of
$MaxAttempts"
Write-Warning "Exiting with error code!"
Exit 1}}
Until($BreakOut -eq $true)
Exit 0}
Else{$Count = $null
Write-Debug 'Adding Nvivo licence.'
Do {$String = & $Nvivo -i $Licence | Out-String
$BreakOutA = $String.Contains('Successfully added license key.')
$BreakOutB = $String.Contains('Unable to replace the license key. The
new key is invalid.')
Write-Debug "Adding licence `$String value is: $String"
Write-Debug "Adding licence `$BreakOut value is: $BreakOut"
Start-Sleep $WaitTimer
$Count = $Count + 1
Write-Debug "The `$Counter vlue is: $Count"
If ($Count -eq $MaxAttempts)
{Write-Debug "The `$Count has reached `$MaxAttempts of
$MaxAttempts"
Write-Warning "Exiting with error code!"
Exit 1}}
Until($BreakOutA -or $BreakOutB -eq $true)

$Count = $null
Write-Debug 'Activating Nvivo.'
Do {$String = & $Nvivo -a Registration.xml | Out-String
$BreakOutA = $String.Contains('Your license has now been activated.')
$BreakOutB = $String.Contains('License key already activated.')
Write-Debug "Activating licence `$String value is: $String"
Write-Debug "Activating licence `$BreakOut value is: $BreakOut"
Start-Sleep $WaitTimer
$Count = $Count + 1
Write-Debug "The `$Counter vlue is: $Count"
If ($Count -eq $MaxAttempts)
{Write-Debug "The `$Count has reached `$MaxAttempts of
$MaxAttempts"
Write-Warning "Exiting with error code!"
Exit 1}}
Until($BreakOutA -or $BreakOutB -eq $true)
Exit 0}

Setup Information:
Setup Type: Windows Installer (MSI)
Deployment Method Used: Windows Installer Command Line (No MST)
Deployment Difficulty: Very Easy
Platform(s): Windows

Vous aimerez peut-être aussi