Change default TimeZone via Powershell API for all User

  • 3
  • Question
  • Updated 1 month ago

Hey,


I want to Change the TimeZone for all ShareFile User. I found a Script via Powershell API. Now my Problem is, that I cannot get a list of supported TimeZones and the correct Syntax for all TimeZones.


Here is the script for better understanding:

# Import the ShareFile SnapIn
 
Add-PSSnapin sharefile -Verbose
 
# Call for Credentials of ShareFile Subdomain "XXX.sharefile.eu"
 
$sfclient = Get-SFclient -Name "\\ad\temp\sflogin.sfps"
 
# The import file would typically be an exported contact list from Outlook or equivalent
# The import file contains "E-mail Address" and "Name" seperated with a "," as delimiter.
 
$contacts = Import-Csv "\\ad\temp\input.csv"
 
foreach ($contact in $contacts)
{
        if ($contact.'E-mail Address')
       
    {
    $Employee = Send-SfRequest -Client $sfClient -Entity Accounts\Employees | where email -like $contact.'E-mail Address'
    $testuser = Send-SfRequest -Client $sfClient -Entity Users -Id $Employee.Id
 
# JSON to set UserPreferences as required *** in this excample TimeZone ***
 
$json = @{"TimeZone"="-300,US,M/d/yy,h:mmt"} | ConvertTo-Json
 
# Send Request with PATCH METHOD to update the Preferences of Entity "Users" depending on UserID with above defined Value
    send-SfRequest -Client $sfClient -Method PATCH -Entity Users -Id $testuser.Id -Navigation Preferences -BodyText $json
 
    # Just for Information the Name and IDs of all patched Accounts.
 
    Write-host "Employee ID" $Employee.Id
    Write-host "Testuser ID" $testuser.Id
    Write-host "Employee Email" $contact.'E-mail Address'
    Write-host "Contact Name" $contact.Name
   
    }
 
}


So I Need a List of supported Syntaxes for the json

$json = @{"TimeZone"="-300,US,M/d/yy,h:mmt"}


Thanks in advance and best regards

Julian


Photo of Julian Jakob

Julian Jakob

  • 2 Posts
  • 0 Reply Likes

Posted 2 months ago

  • 3
Photo of Julian Jakob

Julian Jakob

  • 2 Posts
  • 0 Reply Likes

Any Ideas?


Thanks for your help!