Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function Add-Zip
  2. {
  3.     param([string]$zipfilename)
  4.  
  5.     if(-not (test-path($zipfilename)))
  6.     {
  7.         set-content $zipfilename ("PK" + [char]5 + [char]6 + ("$([char]0)" * 18))
  8.         (dir $zipfilename).IsReadOnly = $false  
  9.     }
  10.  
  11.     $shellApplication = new-object -com shell.application
  12.     $zipPackage = $shellApplication.NameSpace($zipfilename)
  13.  
  14.     foreach($file in $input)
  15.     {
  16.             $zipPackage.CopyHere($file.FullName)
  17.     }
  18. }
  19. cd C:\\logYzm
  20. $z="$env:TMP\t.zip"
  21. del $z
  22. Get-ChildItem C:\\logYzm\\yzmService*|Add-Zip $z
  23. $ws = New-Object System.Net.WebClient
  24. $ws.UploadString($url, "testdata");
  25. $ws.Dispose()
  26. del $z
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement