Public/Set-specPOSPrinterAndDrawerIni.ps1
function Set-specPOSPrinterAndDrawerIni { <# .SYNOPSIS Setup of the TMH6000.ini file for the ITIM Till. .DESCRIPTION Setup of the TMH6000.ini file for the ITIM Till, requires the parameters of POSPrinterOPOSName and CashDrawerOPOSName to amend the file for these entries. #> param ( [Parameter(Mandatory = $true)] [string]$POSPrinterOPOSName, [Parameter(Mandatory = $true)] [string]$CashDrawerOPOSName ) $TMHContent = Get-Content -Path 'C:\DP4\Win\TMH6000.ini' # Replace existing entries with the correct ones for the printer type. # Includes regular expression to locate start of line, one or more spaces present. $TMHNewContent = $TMHContent -replace '^CashDrawer\s+=.*', "CashDrawer = $CashDrawerOPOSName" -replace '^POSPrinter\s+=.*', "POSPrinter = $POSPrinterOPOSName" $TMHNewContent | Set-Content -Path 'C:\DP4\Win\TMH6000.ini' } |