Skip to content

Instantly share code, notes, and snippets.

@Christwiest
Last active November 13, 2016 21:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Christwiest/4ab9b01ff7991172009a2a6d7bfbe780 to your computer and use it in GitHub Desktop.
Save Christwiest/4ab9b01ff7991172009a2a6d7bfbe780 to your computer and use it in GitHub Desktop.
#Make backup directory
$pad = "C:\Temp"
$date = Get-Date
$date = $date.ToString("dd-MM-yyyy")
New-Item -ItemType directory -Path "$Pad\Backup-$date"
$backupfolder = "$Pad\Backup-$date"
#Create building blocks
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportAPPLICATION.XML /type:APPLICATION" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportAUTOMATIONTASK.XML /type:AUTOMATIONTASK" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportCONFIGMGR.XML /type:CONFIGMGR" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportDATASOURCE.XML /type:DATASOURCE" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportDIRECTORYSERVICE.XML /type:DIRECTORYSERVICE" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportEMAIL.XML /type:EMAIL" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportEXECUTECOMMAND.XML /type:EXECUTECOMMAND" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportFOLDERREDIRECTION.XML /type:FOLDERREDIRECTION" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportFOLDERSYNC.XML /type:FOLDERSYNC" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportHOMEDIRECTORY.XML /type:HOMEDIRECTORY" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportLOCATION.XML /type:LOCATION" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportMAPPING.XML /type:MAPPING" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportPRINTER.XML /type:PRINTER" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportLOCATION.XML /type:LOCATION" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportPROFILEDIRECTORY.XML /type:PROFILEDIRECTORY" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportREGISTRY.XML /type:REGISTRY" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportSUBSTITUTE.XML /type:SUBSTITUTE" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportUSERSETTING.XML /type:USERSETTING" -Wait
Start-Process -FilePath "C:\Program Files (x86)\RES Software\Workspace Manager\pwrtech.exe" -ArgumentList "/export $backupfolder\ExportVARIABLE.XML /type:VARIABLE" -Wait
#Zip building blocks
$source = "$Pad\Backup-$date"
$destination = "$Pad\Buildingblockbackup-$date.zip"
If(Test-path $destination) {Remove-item $destination}
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory($Source, $destination)
#move Zip and delete XML and XBB
Move-Item $destination $source
Remove-Item "$Pad\Backup-$date\*.XML"
Remove-Item "$Pad\Backup-$date\*.xbb"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment