Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
zPSDeploy.CreateYourOwn.ps1
# Create a demo project
mkdir C:\MyProject
# Create some stuff to deploy
mkdir C:\MyProject\Stuff
"Important things!" | Out-File C:\MyProject\Stuff\File.txt
# Create folders to deploy this to
mkdir C:\Target
mkdir $env:USERPROFILE\T
# Create a deployments.yml file
@"
MyModuleDeployment:
Author: 'wframe'
Source:
- 'Stuff'
Destination:
- 'C:\Target\Stuff'
- '$env:USERPROFILE\T'
DeploymentType: Filesystem
"@ | Out-File C:\MyProject\deployments.yml
#######
# Load up PSDeploy, inspect the deployment!
Import-Module PSDeploy
Get-PSDeployment -Path C:\MyProject\deployments.yml
# Source : C:\MyProject\Stuff
# DeploymentType : Filesystem
# DeploymentOptions :
# Targets : C:\Target\Stuff
# C:\Users\warre\T
#Looks good, deploy!
Invoke-PSDeployment -path C:\MyProject\deployments.yml
#Verify our deployment worked:
Test-Path C:\Target\Stuff
Test-Path $env:USERPROFILE\T
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment