Public/Update-User.ps1
# Code generated from specification version 1.0.0: DO NOT EDIT Function Update-User { <# .SYNOPSIS Update user .EXAMPLE PS> Update-User -Id $User.id -FirstName "Simon" Update a user #> [cmdletbinding(SupportsShouldProcess = $true, PositionalBinding=$true, HelpUri='', ConfirmImpact = 'High')] [Alias()] [OutputType([object])] Param( # Tenant [Parameter()] [object] $Tenant, # User id (required) [Parameter(Mandatory = $true, ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)] [string] $Id, # User first name [Parameter()] [string] $FirstName, # User last name [Parameter()] [string] $LastName, # User phone number. Format: '+[country code][number]', has to be a valid MSISDN [Parameter()] [string] $Phone, # User email address [Parameter()] [string] $Email, # User activation status (true/false) [Parameter()] [switch] $Enabled, # User password. Min: 6, max: 32 characters. Only Latin1 chars allowed [Parameter()] [string] $Password, # User activation status (true/false) [Parameter()] [ValidateSet('true','false')] [switch] $SendPasswordResetEmail, # Custom properties to be added to the user [Parameter()] [object] $CustomProperties, # Include raw response including pagination information [Parameter()] [switch] $Raw, # Outputfile [Parameter()] [string] $OutputFile, # NoProxy [Parameter()] [switch] $NoProxy, # Session path [Parameter()] [string] $Session, # Don't prompt for confirmation [Parameter()] [switch] $Force ) Begin { $Parameters = @{} if ($PSBoundParameters.ContainsKey("Tenant")) { $Parameters["tenant"] = $Tenant } if ($PSBoundParameters.ContainsKey("FirstName")) { $Parameters["firstName"] = $FirstName } if ($PSBoundParameters.ContainsKey("LastName")) { $Parameters["lastName"] = $LastName } if ($PSBoundParameters.ContainsKey("Phone")) { $Parameters["phone"] = $Phone } if ($PSBoundParameters.ContainsKey("Email")) { $Parameters["email"] = $Email } if ($PSBoundParameters.ContainsKey("Enabled")) { $Parameters["enabled"] = $Enabled } if ($PSBoundParameters.ContainsKey("Password")) { $Parameters["password"] = $Password } if ($PSBoundParameters.ContainsKey("SendPasswordResetEmail")) { $Parameters["sendPasswordResetEmail"] = $SendPasswordResetEmail } if ($PSBoundParameters.ContainsKey("CustomProperties")) { $Parameters["customProperties"] = ConvertTo-JsonArgument $CustomProperties } if ($PSBoundParameters.ContainsKey("OutputFile")) { $Parameters["outputFile"] = $OutputFile } if ($PSBoundParameters.ContainsKey("NoProxy")) { $Parameters["noProxy"] = $NoProxy } if ($PSBoundParameters.ContainsKey("Session")) { $Parameters["session"] = $Session } } Process { foreach ($item in (PSc8y\Expand-Id $Id)) { if ($item) { $Parameters["id"] = if ($item.id) { $item.id } else { $item } } if (!$Force -and !$WhatIfPreference -and !$PSCmdlet.ShouldProcess( (PSc8y\Get-C8ySessionProperty -Name "tenant"), (Format-ConfirmationMessage -Name $PSCmdlet.MyInvocation.InvocationName -InputObject $item) )) { continue } Invoke-Command ` -Noun "users" ` -Verb "update" ` -Parameters $Parameters ` -Type "application/vnd.com.nsn.cumulocity.user+json" ` -ItemType "" ` -ResultProperty "" ` -Raw:$Raw ` -IncludeAll:$IncludeAll } } End {} } |