lørdag den 10. september 2011

Working with SuperOffice users though PowerShell

Updated 24-09-2011: Rewritten, see more here
So you maybe saw my ugly PowerShell scripts to work with SuperOffice in my last blog post. Here is a more “clean” way to handle this

I created a small PowerShell PSCmdlet that you can use to

  • List/Find/Create/Delete and Create Associates with Person objects
  • List/Find/Create/delete Associates
  • Create/Manage/delete License information for Associates
  • Create/Manage/save/remove SuperOffice configurations ( all with superoffice.config / superoffice.ini and the fucking lame DSN links )

Might be worth mentioning that an Associates is the same as an souser. in most cases you create a Person and then link that person to an Associates and then add credentials ( CRM5 / CRM7 / Windows and what ever ) to that person to give them the ability to access superoffice


  • Get-CRM7config
    Returns an empty CRM7Config object. This is what I use to manage connections to different SuperOffice installations and to create/remove client/server configurations
  • Remove-CRM7config
    Removes the files superoffice.config and superoffice.ini and the DSN link.
  • Save-CRM7config
    Creates and saves superoffice.config and superoffice.ini . if need to be called from a client or with a server installation, add –CreateDSN to also create that.
  • Set-CRM7config
    When calling all other powershell commands it looks for this configuration. (saved in local variable $CRM7Config )
  • Get-CRM7Person
    Gets all or a specific Person from SuperOffice
  • Remove-CRM7Person
    Removes the specified Person from SuperOffice (does not check if user also have Associates )
  • Get-CRM7User
    Get all or a specific Associate
  • New-CRM7User
    Creates a new Associate ( InternalAssociate, Anonymous, System, External or Resource). Create a Person if needed or associates with the one supplied.
    Also handles AD integration
  • Remove-CRM7User
    Delete the specified Associate. use –RemovePerson to clean all.
  • Get-CRM7UserLicense
    Returns a more code/user-friendly object you can use to manage permissions for a given user.
    Make your chances to license’s/permissions for the user and then call UpdateUserLicense on the object to save it.
  • Close-CRM7Session
    Close down any open session you might have to SuperOffice
  • Get-MyCRM7Identity
    Returns an instance of the user you are currently logged in as

Precompiled assembly's for .NET version 3.5 and 4.0 attached and the complete source code.
Updated 12-09-2011: I’ve fixed a few errors added a few more powershell commands and a lot more powershell parameters. Notably I’ve added –EncryptedDBUser to Save-CRM7config . That way you can get dbUser and dbpassword encrypted within the superoffice.config file

Ingen kommentarer:

Send en kommentar