Skip to Content
Technical Articles
Author's profile photo Stefan Schnell

How To Get Data From SAP NW Gateway Interface with OData via PowerShell

A month ago I wrote here about the possibility to get data from SAP NW gateway interface with OData via VBScript. Here now an equivalent solution for PowerShell.


  $User = "MyUser"
  $Password = Read-Host -Prompt "Passwort" -AsSecureString
  $Cred = New-Object System.Management.Automation.PSCredential($User, $Password)

  $RequestURI = "$format=xml" 
  $Records = Invoke-RestMethod -Uri $RequestURI -Credential $Cred -Method Get

  ForEach($Record in $Records) {
    $Properties = $Record.Content.Properties
    Write-Host $Properties.LastName $Properties.ForeName


With PowerShell it is absolut easy to get access to the XML object hierarchy.

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.