Enterprise Cloud Control Script
Concept
Enterprise customers can restart Master or Game Servers on clusters of their private Photon Cloud.
This can be done using a PowerShell script that is given to customers on request.
Required Customer Data
The customer's credentials ("CustomerName" and "Key") are required for the script to work.
Also, region tokens and cluster names may be needed.
To better illustrate the restart process, we will use the following example values:
- Customer: "SampleCustomer"
- Key: "MyKey"
- Region: "SomeRegion"
- Cluster: "MyCluster"
Preparing PowerShell
Download the cloud control client zip file. Unblock the "Photon.PrivateCloud.Control.Client.zip" file and then extract its content.
Please make sure to synchronize date and time on the machine running the cloud control script. Otherwise, it might not work.
Open a new PowerShell window. It is recommended to start a new PowerShell session for the cloud control.
If you have the default Windows PowerShell "Restricted" execution policy you need to change it.
We recommend to set it to "RemoteSigned" usingSet-ExecutionPolicy RemoteSigned
. To
get the current execution policy useGet-ExecutionPolicy
.
Read more about "Running Scripts" from Microsoft TechNet.Import the modules needed from the script "Photon.PrivateCloud.Control.Client.psm1" as follows:
Import-Module .\Photon.PrivateCloud.Control.Client.psm1
The available commands imported in the module can be listed using:
Get-Module Photon.PrivateCloud.Control.Client | Select-Object -ExpandProperty ExportedCommands
To get help about a command just use
Get-Help
with the command name available from the previous list.Example to get help about
Restart-PhotonCloud
:Get-Help Restart-PhotonCloud -Detailed
Restart
Use the "Restart-PhotonCloud" command to restart Photon Master or Game Servers on one or all clusters.
Parameters And Default Values
By default, a restart happens for all available game servers on all available clusters across all available regions.
Region
By default, a restart happens across all regions.
If you have more than one region, you can explicity specify on which region the restart should happen.
You can choose one region only at a time using the -Region
string parameter with the value set to a case incensitive region token.
Cluster
By default, a restart happens on all clusters.
If you have more than one cluster and want to restart servers only on a specific one you can do so by specifiying its name.
You can pick one cluster only at a time using the -Cluster
string parameter with the value set to a case incensitive cluster name.
Server Type
By default, a restart happens on all available Game Servers if nothing is explicitly specified.
You can explicitly specify what servers to restart Master
or GameServer
using either:
--ServerType
string parameter which could take two values: "GameServer" (default) or "Master".- or via mutually exclusive switch parameters:
-Master
or-GameServer
.
Examples
Restart Game Server(s) On A Specific Cluster Of A Specific Region
To restart Game Server(s) on a specific cluster (e.g. "MyCluster") of a specific region (e.g. "SomeRegion") you can do this in three ways:
Restart-PhotonCloud -Customer SampleCustomer -Key MyKey -Cluster MyCluster -Region SomeRegion
Restart-PhotonCloud -Customer SampleCustomer -Key MyKey -ServerType GameServer -Cluster MyCluster -Region SomeRegion
Restart-PhotonCloud -Customer SampleCustomer -Key MyKey -GameServer -Cluster MyCluster -Region SomeRegion
Restart Master Server(s) On A Specific Cluster Of A Specific Region
To restart Master Server(s) on a specific cluster (e.g. "MyCluster") of a specific region (e.g. "SomeRegion") you can do this in two ways:
Restart-PhotonCloud -Customer SampleCustomer -Key MyKey -ServerType Master -Cluster MyCluster -Region SomeRegion
Restart-PhotonCloud -Customer SampleCustomer -Key MyKey -Master -Cluster MyCluster -Region SomeRegion
Verify
To check the status of servers restart you can use "Get-PhotonCloudRestartStatus" cmdlet:
Get-PhotonCloudRestartStatus -Customer SampleCustomer -Key MyKey
Back to top