#PowerShell, #PowerWiseScripting, #ProjectWise, PWPS_DAB

How To: Import Documents from a Zip File into ProjectWise Using PowerShell

Be sure to check out my Scripting4Crypto initiative. It’s a fun way to get into using cryptocurrencies all while getting your PowerShell needs met.

With the release of PWPS_DAB module version, we now have the ability to import the contents of a zip file directly into a ProjectWise folder. This is accomplished using the Import-PWDocumentsFromZip PowerShell cmdlet.

It is a fairly straight forward process. We will begin with a zip file containing a number of Excel spreadsheets.


First things first, take a look at the help for the Import-PWDocumentsFromZip cmdlet to familiarize yourself with the available parameters, etc.

Get-Help Import-PWDocumentsFromZip -Full

This cmdlet has a few required parameters that we will need to deal with. There are a few other optional parameters available which will not be covered in this post.

  • InputFileName
  • ParentPWFolderPath
  • StorageArea

Now, we will create and populate a few variables with the file path and name of the zip file to import from and the target ProjectWise folder. We will be using the same storage area as the target ProjectWise folder.

# Path and file name of the zip file importing from.
$ZipFileToImport = "D:\temp\reporting\PW_Reports.zip"
# ProjectWise folder to import documents into.
$ProjectWiseFolder = "PowerShell\FilesFromZip"

Next, we will use the Get-PWFolders cmdlet to get the ProjectWise folder object for the specified folder.

NOTE: You could simply pass the value of the ProjectWiseFolder variable to the Import-PWDocumentsFromZip cmdlet. However, as previously stated, we will be using the same storage area as the target ProjectWise folder.

# ProjectWise Folder object for the folder to import the documents into.
$PWFolder_Object = Get-PWFolders -FolderPath $ProjectWiseFolder -JustOne -Verbose


Then, we will create a splat (a special type of hashtable) with the required parameters and values.

# Splatting containing the parameter name and value pairs.
$Splat_Import = @{
    InputFileName = $ZipFileToImport
    ParentPWFolderPath = $PWFolder_Object.FullPath
    StorageArea = $PWFolder_Object.Storage

Finally, we can run the Import-PWDocumentsFromZip cmdlet using the contents of the splat. ProjectWise Document objects will be returned for each of the new documents  created within the ProjectWise folder.

# The new document objects will be returned.
$ImportedDocuments = Import-PWDocumentsFromZip @Splat_Import -Verbose

You can see that each of the Excel files were imported into the specified ProjectWise folder.


Experiment with it and have fun.

Hopefully, you find this useful. Please let me know if you have any questions or comments.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.