Skip to content

Powershell code sample

robertj edited this page Sep 14, 2010 · 8 revisions

creating user accounts:

$UserService = New-GDataUserService -AdminPassword Password -AdminUsername admin@domain.com
$MailSettingsService = New-GDataMailSettingsService -AdminPassword Password -AdminUsername admin@domain.com

New-GDataUser -UserService $UserService -FamilyName $FamilyName -GivenName $GivenName -ID $id -Passsword $password
Add-GDataUserNickName -UserService $UserService -ID $id -NickName $nickname

Set-GDataMailSetting -ID $id -Name "$GivenName $FamilyName" -SenderAdress $nickname -IsDefault -MailSettingsService $MailSettingsService

creating contacts:

$ContactService = New-GDataContactService -AdminPassword Password -AdminUsername admin@domain.com
New-GDataContact -ContactService $ContactService -Name "Robert Jonsson" -EmailAddress robert.jonsson@plan-tre.net -PhoneNumber 04166547211 -PostalAddress "Ankeborg 12"

creating groups:

$GroupService = New-GDataGroupService -AdminPassword Password -AdminUsername admin@domain.com

New-GDataGroup -GroupService $GroupService -Name GDataCmdLet -Description "Dist Group" -ID gdatacmdlet@domain.com -EmailPermission Anyone
Add-GDataGroupMember -id gdatacmdlet@domain.com -GroupService $GroupService -UserID robert.jonsson@domain.com
Clone this wiki locally