Public/API/Get-SteamPlayerBan.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function Get-SteamPlayerBan {
    <#
    .SYNOPSIS
    Returns Community, VAC, and Economy ban statuses for given players.

    .DESCRIPTION
    Returns Community, VAC, and Economy ban statuses for given players.

    .PARAMETER SteamID64
    Comma-delimited list of 64 bit Steam IDs to return player ban information for.

    .PARAMETER OutputFormat
    Format of the output. Options are json (default), xml or vdf.

    .EXAMPLE
    Get-SteamPlayerBan -SteamID64 76561197960435530, 76561197960434622

    .INPUTS
    Array of int64.

    .OUTPUTS
    Returns a string that is either formatted as json, xml or vdf.

    players: List of player ban objects for each 64 bit ID requested
    - SteamId (string) The player's 64 bit ID.
    - CommunityBanned (bool) Indicates whether or not the player is banned from Steam Community.
    - VACBanned (bool) Indicates whether or not the player has VAC bans on record.
    - NumberOfVACBans (int) Number of VAC bans on record.
    - DaysSinceLastBan (int) Number of days since the last ban.
    - NumberOfGameBans (int) Number of bans in games, this includes CS:GO Overwatch bans.
    - EconomyBan (string) The player's ban status in the economy. If the player has no bans on record the string will be "none", if the player is on probation it will say "probation", etc.

    .NOTES
    Author: Frederik Hjorslev Nylander

    .LINK
    https://hjorslev.github.io/SteamPS/Get-SteamPlayerBan.html
    #>


    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $true,
            HelpMessage = '64 bit Steam ID to return player bans for.',
            ValueFromPipelineByPropertyName = $true)]
        [int64[]]$SteamID64,

        [Parameter(Mandatory = $false,
            HelpMessage = 'Format of the output. Options are json (default), xml or vdf.')]
        [ValidateSet('json', 'xml', 'vdf')]
        [string]$OutputFormat = 'json'
    )

    begin {
        Write-Verbose -Message "[BEGIN ] Starting: $($MyInvocation.MyCommand)"
    }

    process {
        $Request = Invoke-WebRequest -Uri "https://api.steampowered.com/ISteamUser/GetPlayerBans/v1/?format=$OutputFormat&key=$(Get-SteamAPIKey)&steamids=$($SteamID64 -join ',')" -UseBasicParsing

        Write-Output -InputObject $Request.Content
    } # Process

    end {
        Write-Verbose -Message "[END ] Ending: $($MyInvocation.MyCommand)"
    }
} # Cmdlet