Project Server and Project Online: Creating a Project Pro Account using PowerShell


Thanks to Chris Boyd for sharing this script that helps with the automation of account creation for Project Professional and Project Pro for Office 365 users (hereafter just called Project Pro).  And to be clear, the account I am talking about here is the account normally configured through Project Pro – File, Info, Manage Accounts – and governs the connections available and their behavior when starting Project Pro, and not the account you might create in PWA on either Project Server or Project Online.

image

The following script should be copied locally to a file titles CreateAccount.ps1, then would be executed by an administrator on the computer that already has Project Pro for Office 365 or Project Professional installed.  This will work for 2013 and 2016 – you could also edit the registry key if you wanted to use for earlier versions.  Then you’d navigate to the directory containing the script and execute with two parameters – the Account name and also the PWA URL – so for example:

.\CreateAccount.ps1 PWA https://Contoso.SharePoint.com/sites/pwa

You would need to have the appropriate setting for your PowerShell execution policy – see http://go.microsoft.com/fwlink/?LinkID=135170 for more information

And now the script…

#
# This script will create the account for Project Pro for O365 to connect to Project Online. 
# 
# Execute this script with two parameters: the account name and PWA URL
#
# ./CreateAccount.ps1 PWA https://contoso.sharepoint.com/sites/pwa
#
########################################################################################################################

Param(
  [string]$accountName,
  [string]$pwaURL
)

function CreateAccount ($keyPath, $accountName, $pwaURL)  {

    $guid = [System.Guid]::NewGuid()

    New-Item -Path "$keyPath$accountName"
    New-ItemProperty -Path "$keyPath$accountName" -Name Name -PropertyType String -Value $accountName
    New-ItemProperty -Path "$keyPath$accountName" -Name GUID -PropertyType String -Value "{$guid}"
    New-ItemProperty -Path "$keyPath$accountName" -Name Path -PropertyType String -Value $pwaURL
}


function CreateProjectOnlineAccount ($accountName, $pwaURL)
{
    $15keyPath = "HKCU:\Software\Microsoft\Office\15.0\MS Project\Profiles\"
    $16keyPath = "HKCU:\Software\Microsoft\Office\16.0\MS Project\Profiles\"

    If (Test-Path($15keyPath)) {
  
        CreateAccount $15keyPath $accountName $pwaURL
    }


    If (Test-Path($16keyPath)) {
        CreateAccount $16keyPath $accountName $pwaURL
    }
}

CreateProjectOnlineAccount $accountName $pwaURL 
  

On its own this probably does not save much time – but if used with a suitable GPO configuration thjis could be used to push accounts out to users – see the the Scripting Guy’s blog on this topic for more information - http://blogs.technet.com/b/heyscriptingguy/archive/2010/08/14/weekend-scripter-using-group-policy-to-deploy-a-windows-powershell-logon-script.aspx 

Enjoy!  And apologies if you saw an incomplete posting first time – finger trouble caused a premature publishing…

Comments (0)

Skip to main content