Last active
June 11, 2018 15:00
-
-
Save duffney/af13bc42d5f3f4bc4660 to your computer and use it in GitHub Desktop.
Create-PullServerModule.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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