forked from IcmpOff/rpuk-leak
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stop.ps1
31 lines (25 loc) · 982 Bytes
/
stop.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Change to the correct working directory (see https://stackoverflow.com/questions/4724290/powershell-run-command-from-scripts-directory)
$scriptpath = $MyInvocation.MyCommand.Path
$dir = Split-Path $scriptpath
cd $dir
[xml] $scriptConfig = Get-Content "scriptConfig.xml"
$server = Get-Process FXServer -ErrorAction SilentlyContinue
if ($server) {
# Send HTTP request to server process to do shutdown
try {
$body = ConvertTo-Json @{
api_key = $scriptConfig.Config.APIKey
type = 'restart'
params = {}
}
Invoke-WebRequest -Uri $scriptConfig.Config.Endpoint -Method 'POST' -ContentType 'application/json' -Body $body -UseBasicParsing
Start-Sleep -Seconds 10
} catch {
echo 'Failed to invoke restart script - data may not sync properly'
echo $_
}
taskkill /IM FXServer.exe /F
taskkill /IM FXServer.exe /F
taskkill /IM FXServer.exe /F
taskkill /IM FXServer.exe /F
}