Skip to content

Instantly share code, notes, and snippets.

@duffney
Last active June 11, 2018 15:00
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save duffney/af13bc42d5f3f4bc4660 to your computer and use it in GitHub Desktop.
Save duffney/af13bc42d5f3f4bc4660 to your computer and use it in GitHub Desktop.
Create-PullServerModule.ps1
$source = "C:\LabResources\xTimeZone"
$destination = "C:\temp"
$Version = (Get-ChildItem -Path $source -Depth 1).Name
$ResoureName = (Get-ChildItem -Path $source -Depth 1).Parent.Name
$ModuleName = $ResoureName+'_'+$Version
New-Item -Path ($destination+'\'+$ModuleName) -ItemType Directory
Get-ChildItem ($source+'\'+$Version) | Copy-Item -Destination ($destination+'\'+$ModuleName)
$destinationZip = ($destination+'\'+$ModuleName)+'.zip'
If(Test-path $destinationZip) {Remove-item $destinationZip -Force}
Add-Type -assembly "system.io.compression.filesystem"
[io.compression.zipfile]::CreateFromDirectory(($destination+'\'+$ModuleName), $destinationZip)
Remove-Item -Path ($destination+'\'+$ModuleName) -Force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment