About
The package is a user-based install. It installs to the user profile (%LocalAppData%) and creates its Uninstall key in the HKEY_CURRENT_USER registry hive. For this reason, it needs to run in the user context. This package has been created in native PowerShell and can be run as a standard user.
A loop has been added to wait until the setup exe finishes, before adding a couple of additional registry keys.
GOTCHA: Uninstalling this add-in appears to break the user profile for reinstallations of Grammarly. For this reason, no Uninstall script has been created.
Obtain Package Source
Download the installer from grammarly.com.
Create XML file for Package Metadata
All variables are added to a XML file (The required information can be retrieved from the registry after performing a manual install of the software). This sets the variables in the script proper, with the added benefit of enabling easier reporting on deployed packages in your environment.
deployInfo.xml
<Package>
<Metadata>
<Publisher>Grammarly</Publisher>
<DisplayName>Grammarly for Microsoft® Office Suite</DisplayName>
<ShortName>Grammarly</ShortName>
<DisplayVersion>6.6.137</DisplayVersion>
<GUID>{ebb53db5-cf44-4427-8d83-64fb4c7357df}</GUID>
<Architecture>x86</Architecture>
<Language>EN</Language>
<Revision>02</Revision>
<Date>28/11/2018</Date>
<Author>cru2.io</Author>
</Metadata>
</Package>
Install
The installer is a PowerShell script. Silent Install command:
powershell.exe -ExecutionPolicy RemoteSigned -File ./Install.ps1
Install.ps1
<#
Powershell script to install Grammarly
Created 28/11/2018 | cru2.io #>
# Set Variables
$CurrentPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
[XML]$deployInfo = (Get-Content "$CurrentPath\deployInfo.xml")
[string]$appVendor = $deployInfo.Package.Metadata.Publisher
[string]$appName = $deployInfo.Package.Metadata.DisplayName
[string]$appVersion = $deployInfo.Package.Metadata.DisplayVersion
[string]$appShortName = $deployInfo.Package.Metadata.ShortName
[string]$appFullName = "$appVendor $appName $appVersion"
[string]$appGUID = $deployInfo.Package.Metadata.GUID
[string]$appRegPath = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\$appGUID"
[string]$appPath = "$env:LocalAppData\Grammarly\Grammarly for Microsoft Office Suite"
# Install
Start-Process `"$CurrentPath\GrammarlyAddInSetup.exe`" -Wait -PassThru -NoNewWindow -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
$i = 0
do
{
$i++
$processRtn = Get-Process | Where { $_.name -like '*Grammarly*' }
$processRtn | Select *
Write-Host $("Waiting for process to finish" + $i.ToString())
Start-Sleep -Seconds 10
}while ($processRtn -ne $Null)
# Create additional registry keys
If (Test-Path $appRegPath)
{
New-ItemProperty -Path $appRegPath -Name "InstallDate" -Value (Get-Date -UFormat "%Y%m%d") -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
}
Deployment Info
Detection rules for SCCM.
Grammarly for Microsoft® Office Suite 6.6.137
Grammarly
%LocalAppData%\Grammarly\Grammarly for Microsoft Office Suite
Hive: HKEY_CURRENT_USER
Key: Software\Microsoft\Windows\CurrentVersion\Uninstall\{ebb53db5-cf44-4427-8d83-64fb4c7357df}
Value: DisplayVersion
DataType: Version
Data: 6.6.137
Operator: Greater than or equal to
32-bit: No
SCCM Requirement: None