[ngw] GW2014 REST-API and PowerShell - sorry for the spam - delete this, testing some code

Brad Rodgers BRodgers at cesa7.org
Wed Feb 25 18:29:15 UTC 2015


rstuvw


Brad Rodgers
Director of Agency Technology and
Director of Facilities & Automobile Fleet
920.617.5648
brodgers at cesa7.org
 
 


>>> "Paul Lamontagne" <Paul.Lamontagne at lamtechconsulting.com> 2/25/2015
12:25 PM >>>
mnopq



Paul Lamontagne

Co-Author of The Caledonia Upgrade Guide for GroupWise 2014
http://postie.caledonia.net/store/
Become a GroupWise Power Admin
http://www.caledonia.net/register

>>> "James Taylor" <James.Taylor at eastcobbgroup.com> 25/02/2015 12:52
PM >>>
ghjkl 


James Taylor
678-697-9420
james.taylor at eastcobbgroup.com



>>> "Morris Blackham" <mblackham at gw.novell.com> 2/25/2015 11:42 AM >>>

asdf

>>> "Barth Uwe" <Uwe.Barth at stadt-chemnitz.de> 2/25/2015 2:01 AM >>>
Hello,

actually I try to use PowerShell v4 for some GroupWise administration
tasks via REST-API. Unfortunately I'm unable to send a simple
Invoke-RestMethod command like this:

<code>
$uri = "https://grpwise.example.com:9710/gwadmin-service"
$gwuser = "johndoe"
$gwpwd = "johndoespassword"
$gwdom = "gwdom"
$gwpo = "gwpo"
$gwfid = "3qq"
$uri += "/domains/" + $gwdom +"/postoffices/" + $gwpo +
"/users?fileId=" + $gwfid
$encoded =
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($gwuser+":"+$gwpwd
))
$headers = @{Authorization = "Basic "+$encoded}
Invoke-RestMethod -Uri $uri -Headers $headers -Method GET -Verbose 
</code>

I always get an error like this:

<error>C:\> C:\gwhelper\gwrest.ps1
https://grpwise.example.com:9710/gwadmin-service/domains/gwdom/postoffices/gwpo/users?fileId=3qq

AUSFÜHRLICH: GET
https://grpwise.example.com:9710/gwadmin-service/domains/gwdom/postoffices/gwpo/users?fileId=3qq
with 0-byte payload
Invoke-RestMethod : The underlying connection was closed: An
unexpected
error occurred on a send.
In  C:\gwhelper\gwrest.ps1:23 Zeichen:1
+ Invoke-RestMethod -Uri $uri -Headers $headers -Method GET -Verbose
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo  	    : InvalidOperation:
(System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod],
WebException
    + FullyQualifiedErrorId :
WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
</error>

The resulting uri is correct (tested with browser). CA-Certificate is
imported in Windows CertStore. Before the import I got a clear SSL
certificate error message for this.

Does someone here use PowerShell v4 with Invoke-RestMethod
successfully?

Uwe

_______________________________________________
ngw mailing list
ngw at ngwlist.com
http://ngwlist.com/mailman/listinfo/ngw

_______________________________________________
ngw mailing list
ngw at ngwlist.com
http://ngwlist.com/mailman/listinfo/ngw



This e-mail message together with any attachments or reply should not be
considered private or confidential because it may be archived and
subject to public disclosure under certain circumstances, such as
requests made pursuant to Wisconsin public records law.

The message is intended solely for the use of the individual or entity
to which they are addressed. Please notify the sender immediately by
e-mail if you have received this e-mail by mistake and delete this
e-mail from your system. Please note that the views or opinions
presented in this e-mail are solely those of the author and do not
necessarily represent those of Cooperative Educational Service Agency
#7. Any unauthorized use, distribution, copying or disclosure by you or
to any other person is prohibited.


More information about the ngw mailing list