Tired of looking at all those misspelled cmdlet and parameter names in Word. Use this PowerShell script to add all the Lync cmdlets and parameters into your own custom dictionary. Very useful for double checking that your cmdlets and parameters are spelled correctly.
UPDATE: (5/8/2012) Modified to include parameters.
Prerequisites: You will need to have the Lync Core Components installed. Don’t forget to apply the latest updates as well.
#Title: Create-LyncCusomtDic.ps1
#
#Purpose: To parse all the Lync PowerShell cmdlets and parameters and add them to the Microsoft Word CUSTOM.DIC file.
#
#Author: Matt Wade
#
#Version: 2.0
#
#Date: 5/8/2012
Import-Module Lync #You will need to install the Lync Core Components to get this module. Don't forget to apply the latest CU as well.
$commands = Get-Command -module lync
$mydict = get-content (((Get-Item Env:Appdata).Value) + "\Microsoft\UProof\CUSTOM.DIC")
$newdictentries = @()
foreach ($command in $commands)
{
if ((($mydict -contains ($command.Name)) -eq $false) -and (($newdictentries -contains ($command.name)) -eq $false))
{
$newdictentries += ($command.Name)
}
if (($command.Parameters -ne $null) -and ($command.Parameters.Keys.Count) -gt 0)
{
foreach ($parameterkey in $command.Parameters.Keys)
{
if ((($mydict -contains $parameterkey) -eq $false) -and (($newdictentries -contains $parameterkey) -eq $false))
{
$newdictentries += $parameterkey
}
}
}
}
if ($newdictentries.count -gt 0)
{
$mydict += $newdictentries
$mydict = $mydict |sort-object
$mydict
Copy-Item -Path (((Get-Item Env:Appdata).Value) + "\Microsoft\UProof\CUSTOM.DIC") -Destination (((Get-Item Env:Appdata).Value) + "\Microsoft\UProof\CUSTOM.BAK")
$mydict | Out-File (((Get-Item Env:Appdata).Value) + "\Microsoft\UProof\CUSTOM.DIC")
}
{ 0 comments }
