Many users are migrating to the Office 365 platform and a good portion of those are migrating from GroupWise. I recently had the opportunity to migrate a client from GroupWise to Office 365 and wanted to leverage PowerShell. There are several good reasons for this:
- There are limited reports available from GroupWise and they never seemed to give me exactly what I wanted.
- I wanted to get mailbox sizes and address book sizes in an excel format I could use for quick comparisons to see if a migration was successful.
- We spread the migrations across 10 servers and wanted to organize users based upon mailbox size or number of messages so they would finish in the time frame allowed.
- I needed to get the email aliases of the user in GroupWise so we could ensure the new mailbox in the cloud carried those same aliases.
- I wanted to exercise my PowerShell chops – could it even be done?
Firstly, and most importantly, I believe you need GroupWise 8 SP1 for most of this to work properly. I haven’t tried it on earlier versions, so your mileage may vary.
To make this script work, you will need a few things:
- Create a Novell GroupWise Trusted Application
- SOAP needs to be enabled on the GroupWise Servers
- Novell SOAP API document – I am only showing the hard part which is getting the SOAP connection started, you will need to adjust so you can create your own SOAP queries
Here is the script, please do not run it in your environment w/o careful review… (there are limited comments here – I may add some when I have more time)
#region functions
function Execute-SOAPRequest (
[Xml]$SOAPRequest,
[String]$URL, [String]$actionUrl,[String]$session, [String]$gwapicall)
{
write-host “Sending SOAP Request To Server: $URL”
$soapWebRequest = [System.Net.WebRequest]::Create($URL)
$soapWebRequest.Headers.Add(“SOAPAction”,”`”loginRequest`””)
$soapWebRequest.ContentType = “text/xml;charset=`”utf-8`””
$soapWebRequest.Accept = “text/xml”
$soapWebRequest.Method = “POST”
$soapPartII = $null
if (-not $SOAPRequest) {
write-host “Creating SOAP packet.”
$soapPartI = ‘
<s:Envelope xmlns:s=”http://schemas.xmlsoap.org/soap/envelope/”>
<s:Header>
<h:gwTrace xmlns:h=”http://schemas.novell.com/2005/01/GroupWise/types” xmlns=”http://schemas.novell.com/2005/01/GroupWise/types”>false</h:gwTrace>
<h:session xmlns:h=”http://schemas.novell.com/2005/01/GroupWise/types” xmlns=”http://schemas.novell.com/2005/01/GroupWise/types”>’
$soapPartI += $session
$soapPartI += ‘</h:session></s:Header>
<s:Body xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>’
$soapPartI += $gwapicall
$soapPartI += ‘
<getAddressBookListRequest />
</s:Body></s:Envelope>
‘
$soapPartII =
$soapPartI
} else { $soapPartII = $SOAPRequest }
write-host “Initiating Send.”
$requestStream = $soapWebRequest.GetRequestStream()
$soapPartII.Save($requestStream)
$requestStream.Close()
write-host “Send Complete, Waiting For Response.”
$resp = $soapWebRequest.GetResponse()
$responseStream = $resp.GetResponseStream()
$soapReader = [System.IO.StreamReader]($responseStream)
$ReturnXml =
[Xml] $soapReader.ReadToEnd()
$responseStream.Close()
write-host “Response Received.”
return $ReturnXml
}
#endregion
$myAdmin = “DOMAIN\GWADMIN”
$myPwd = “passwordhere”
$domainName=”PODOMAIN”
$postOfficeName=”PONAME”
$myUri = http://XXXX:XXX/soap
#************** Send the request – get session key ************************************************
$soap =
@’
<s:Envelope xmlns:s=”http://schemas.xmlsoap.org/soap/envelope/”>
<s:Header>
<h:gwTrace xmlns:h=”http://schemas.novell.com/2005/01/GroupWise/types” xmlns=”http://schemas.novell.com/2005/01/GroupWise/types”>false</h:gwTrace>
</s:Header>
<s:Body xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<loginRequest xmlns=”http://schemas.novell.com/2005/01/GroupWise/methods”><auth xsi:type=”q1:TrustedApplication” xmlns:q1=”http://schemas.novell.com/2005/01/GroupWise/types”>
<q1:username>JETTONK</q1:username><q1:name>PowershellTrustedApp</q1:name>
<q1:key>INSERTKEYHERE</q1:key>
</auth><version>1.04</version></loginRequest>
</s:Body></s:Envelope>
‘@
$ret = Execute-SOAPRequest $soap $myUri
Write-Host -ForegroundColor Cyan $ret.InnerXml
$parseXml = $ret.InnerXml
$sessionid = $parseXml.GetElementsByTagName(“session”).’#text’
Write-Host -ForegroundColor DarkGreen session $sessionid
#************** Send the request – getdiskspace ************************************************
# get disk space
$GwAPIstring = ‘<getDiskSpaceUsageRequest xmlns=”http://schemas.novell.com/2005/01/GroupWise/methods”/>’
$ret = Execute-SOAPRequest $null $myUri $null $sessionid $GwAPIstring
write-host $ret.InnerXml
Comments or suggestions welcomed on this script, it was designed and created during a project in a few hours. Let me know if you found it useful.