add script entry point

This commit is contained in:
onyx-and-iris 2023-11-29 22:54:52 +00:00
parent 4966bee0b8
commit 61f7afb9f7

View File

@ -75,6 +75,7 @@ Function Get-ConnFromPSD1 {
return Import-PowerShellDataFile -Path $configpath return Import-PowerShellDataFile -Path $configpath
} }
Function Main {
try { try {
$conn = Get-ConnFromPSD1 $conn = Get-ConnFromPSD1
$rcon = Connect-Rcon -hostname $conn.host -port $conn.port -passwd $conn.passwd $rcon = Connect-Rcon -hostname $conn.host -port $conn.port -passwd $conn.passwd
@ -92,3 +93,9 @@ try {
finally { finally {
Disconnect-Rcon -rcon $rcon Disconnect-Rcon -rcon $rcon
} }
}
if ($MyInvocation.InvocationName -ne '.') {
Main
}