question

Spektra Games avatar image
Spektra Games asked

Create a Multiplayer Server Build with PowerShell

I am trying to creating a build that using Windows operating system and Process server type. But I am getting some errors when running ps1 script. Where am i doing wrong?

My ps1 script:

[string] $ZipName = "server_25_05_2022_12_17_42.zip"
[string] $BuildNameWithExtension = "server.exe"


Set-PfTitle -TitleID "MY_TITLE_ID" -SecretKey "MY_SECRET_KEY"


$vmSize = "Standard_D2as_v4"
$regions = @( @{ StandbyServers = 1; MaxServers = 1; Region = 'EastUS'; ScheduledStandbySettings = $NULL } )
$ports = @( @{ Name = 'game_port'; Protocol = 'UDP' })
$gameAssets = @( @{ FileName = $ZipName } )
$request = @{ BuildName = 'Test'; GameAssetReferences = $gameAssets; MultiplayerServerCountPerVm = 1; Ports = $ports; RegionConfigurations = $regions; StartMultiplayerServerCommand = $BuildNameWithExtension}


$buildResponse = New-PfBuild -BuildName Test -CreateBuildWithProcessBasedServerRequest $request -ContainerFlavor ManagedWindowsServerCore -StartMultiplayerServerCommand $BuildNameWithExtension -GameAssetReferences $gameAssets -VMSize $vmSize -MultiplayerServerCountPerVM 1 -Ports $ports -RegionConfigurations $regions


$buildResponse | ConvertTo-Json -depth 5

The error I got:

PS C:\Users\yusuf\Desktop\ParkingMasterMultiplayer_2\PlayFabMultiplayerPSScripts> ./test.ps1
code status data
---- ------ ----
 200 OK     @{EntityToken=NHxIYmFuRjdsL2V2NzJiUGpRcWpVSU9QZkRqdWFYVmJUVWFWZ2ZzUUppVHhrPXx7ImkiOiIyMDIyLTA1LTI1VDEwOj...
New-PfBuild : Parameter set cannot be resolved using the specified named parameters.
At C:\Users\yusuf\Desktop\ParkingMasterMultiplayer_2\PlayFabMultiplayerPSScripts\test.ps1:12 char:18
+ ... dResponse = New-PfBuild -BuildName Test -CreateBuildWithProcessBasedS ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [New-PfBuild], ParameterBindingException
    + FullyQualifiedErrorId : AmbiguousParameterSet,New-PfBuild

Line 12:

$buildResponse = New-PfBuild -BuildName Test -CreateBuildWithProcessBasedServerRequest $request -ContainerFlavor ManagedWindowsServerCore -StartMultiplayerServerCommand $BuildNameWithExtension -GameAssetReferences $gameAssets -VMSize $vmSize -MultiplayerServerCountPerVM 1 -Ports $ports -RegionConfigurations $regions

multiplayercommunity
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

Please refer to CREATEBUILDWITHPROCESSBASEDSERVERREQUEST : Creates a multiplayer server build with the game server running as a process and returns information about the build creation request which shows all available parameters related to CREATEBUILDWITHPROCESSBASEDSERVERREQUEST. For the current request, you can refer to the code below.

[string] $ZipName = "server_25_05_2022_12_17_42.zip"
[string] $BuildNameWithExtension = "server.exe"
Set-PfTitle -TitleID "MY_TITLE_ID" -SecretKey "MY_SECRET_KEY"
$vmSize = "Standard_D2as_v4"
$regions = @( @{ StandbyServers = 0; MaxServers = 1; Region = 'EastUS'; ScheduledStandbySettings = $NULL } )
$ports = @( @{ Name = 'game_port'; Protocol = 'UDP' })
$gameAssets = @( @{ FileName = $ZipName } )
$request = @{ BuildName = 'Test'; GameAssetReferences = $gameAssets; MultiplayerServerCountPerVm = 1; Ports = $ports; RegionConfigurations = $regions; StartMultiplayerServerCommand = $BuildNameWithExtension; VMSize = $vmSize}
New-PfBuild -CreateBuildWithProcessBasedServerRequest $request
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.