How restart a TM1 instance from remote computer

Planning Analytics 2.0.9

Microsoft Windows 2019 server

How to stop a TM1 instance from other computer?

Suggested Solution:

Enter below in notepad++ and save as a powershell script named tm1script.ps1

#REM powershell script
#REM enter first the command then the tm1 instance
#REM Get-Service -ComputerName computername -Name servicename | Start-Service

#REM get the server name from a text file that you prepare before
$computers = Get-Content c:\temp\servers.txt

#REM get the command parameters
$action = $args[0]
$tm1instance = $args[1]

#REM if stop do this else do that
If ($action -eq “stop” )
{Get-Service -Computername $computers -Name $tm1instance | Stop-Service }
ElseIf ($action -eq “start” )
{Get-Service -Computername $computers -Name $tm1instance | Start-Service }

#REM if none of above, then enter a line in windows event log
write-eventlog -Computername $computers -logname Application -source EventSystem -eventID 1000 -message “something else happened.”

Create a text file with the servername for the windows server that you have tm1 installed on.

Place the text file in c:\temp folder on the computer where you want to run the script.

The account running the script need to be administrator on the target host machine to be able to connect and stop windows services.

Enter command: ./tm1script.ps1  stop “planning sample”

The tm1 instance need to be inside ” when it have a space in the name.

More information:

PowerShell Basics: ElseIf Statement