8
0
Skriptentwickung/current/DD-Core/Restart-InsidersInvoiceMatchingServer/Restart-InsidersInvoiceMatchingServer.ps1

52 lines
3.1 KiB
PowerShell

# Restart-InsidersInvoiceMatchingServer
# ----------------------------------------------------------------------------
# This Script provides the insiders DB with new data
#
# Returns: -
# ----------------------------------------------------------------------------
# Copyright (c) 2023 by Digital Data GmbH
#
# Digital Data GmbH • Ludwig-Rinn-Strasse 16 • D-35452 Heuchelheim
# Tel.: 0641/202360 • E-Mail: info-flow@digitaldata.works
# ----------------------------------------------------------------------------
# Creation Date / Author: 28.09.2023 / MK
# Version Date / Editor: 28.09.2023 / MK
# Version Number: 1.0.0.0
# ========================================================================================================================================
# First check if system wide PowerShell SQL Cmdlet ist installed: "Install-Module -Name SqlServer"
# Check if named Pipes on the SQL Server is enabled
# Configure ConnString like:
# ConnString="Data Source=SERVERNAME\INSTANCE;Initial Catalog=DD_ECM;Trusted_Connection=True;TrustServerCertificate=true;"
# Or
# ConnString="Data Source=SERVERNAME\INSTANCE;Initial Catalog=DD_ECM;User Id=SQLUSERNAME;Password=SQLPASSWORD;TrustServerCertificate=true;"
# ========================================================================================================================================
#-----------------------------------------------------------------------------------------------------#
############################################ set variables ############################################
#-----------------------------------------------------------------------------------------------------#
[String]$ConnString = "Data Source=sdb01\DIGITALDATA;Initial Catalog=DD_ECM;Trusted_Connection=True;TrustServerCertificate=true;"
[String]$smartFIXPath = "D:\ProgramFiles\smartFIX_50"
[String]$smartFIXServer = "sdmsapp1"
#-----------------------------------------------------------------------------------------------------#
############################################# main part ###############################################
#-----------------------------------------------------------------------------------------------------#
Write-Host "Start SQL Procedure"
Invoke-Sqlcmd -Query "EXEC [dbo].[PRCUST_SYNC_SMARTFIX_ORDER_ITEMS] 1" -ConnectionString $ConnString
Write-Host "Stop Matching Server"
& "$smartFIXPath\System\bin\SFControl.exe" -t $smartFIXServer/InvoiceMatchingServer
Write-Host "Start Matching Server"
& "$smartFIXPath\System\bin\SFControl.exe" -start $smartFIXServer/InvoiceMatchingServer
#-----------------------------------------------------------------------------------------------------#
########################################### finishing part ############################################
#-----------------------------------------------------------------------------------------------------#
Remove-Variable -Name ConnString -Force -ErrorAction SilentlyContinue
Remove-Variable -Name smartFIXPath -Force -ErrorAction SilentlyContinue
Remove-Variable -Name smartFIXServer -Force -ErrorAction SilentlyContinue