Advertisement
Guest User

Untitled

a guest
Nov 27th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $source = "C:\LabResources\xTimeZone"
  2.  
  3. $destination = "C:\temp"
  4.  
  5. $Version = (Get-ChildItem -Path $source -Depth 1).Name
  6. $ResoureName = (Get-ChildItem -Path $source -Depth 1).Parent.Name
  7. $ModuleName = $ResoureName+'_'+$Version
  8.  
  9. New-Item -Path ($destination+'\'+$ModuleName) -ItemType Directory
  10.  
  11. Get-ChildItem ($source+'\'+$Version) | Copy-Item -Destination ($destination+'\'+$ModuleName)
  12.  
  13. $destinationZip = ($destination+'\'+$ModuleName)+'.zip'
  14.  
  15.  
  16.  
  17. If(Test-path $destinationZip) {Remove-item $destinationZip -Force}
  18.  
  19. Add-Type -assembly "system.io.compression.filesystem"
  20.  
  21. [io.compression.zipfile]::CreateFromDirectory(($destination+'\'+$ModuleName), $destinationZip)
  22.  
  23. Remove-Item -Path ($destination+'\'+$ModuleName) -Force
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement