logo
down
shadow

How to extract exe file without installing it, using powershell?


How to extract exe file without installing it, using powershell?

By : ganesrraj
Date : November 17 2020, 01:00 AM
like below fixes the issue I am trying to extract one .exe file without installing it. The way to do in CMD is , Perhaps...
code :
start_process C:\Users\ramadeviA.WINMAGIC\Downloads\Setip.exe -Argumentlist "/a" that should be it


Share : facebook icon twitter icon
PowerShell: Get the MSI product code out of a MSI file without installing?

PowerShell: Get the MSI product code out of a MSI file without installing?


By : Desmond
Date : March 29 2020, 07:55 AM
I hope this helps . Here is a script that reads the product code based on this article:
code :
$path = "pathto.msi"

$comObjWI = New-Object -ComObject WindowsInstaller.Installer
$MSIDatabase = $comObjWI .GetType().InvokeMember("OpenDatabase","InvokeMethod",$Null,$comObjWI,@($Path,0))
$Query = "SELECT Value FROM Property WHERE Property = 'ProductCode'"
$View = $MSIDatabase.GetType().InvokeMember("OpenView","InvokeMethod",$null,$MSIDatabase,($Query))
$View.GetType().InvokeMember("Execute", "InvokeMethod", $null, $View, $null)
$Record = $View.GetType().InvokeMember("Fetch","InvokeMethod",$null,$View,$null)
$Value = $Record.GetType().InvokeMember("StringData","GetProperty",$null,$Record,1)
Execute Powershell from File Explorer after installing VS Code

Execute Powershell from File Explorer after installing VS Code


By : user7614849
Date : March 29 2020, 07:55 AM
seems to work fine VS Code is not really positioning itself as the new way to work with PowerShell, it will be the only "built-in" way with Windows to work with it because the PowerShell ISE is being depreciated.
Either way, VS Code did not cause that option to disappear. I have VS Code and the PS extension on my machine and still have access to both options:
How can I download a file from S3 via Powershell without installing AWS SDK?

How can I download a file from S3 via Powershell without installing AWS SDK?


By : user3167946
Date : March 29 2020, 07:55 AM
it should still fix some issue There were a few errors, notably how you were computing the signature, building the timestamp, and the error that you were seeing is because the parameters weren't properly being passed along.
Here's a version that corrects those issues:
code :
$method = 'GET'
$service = 's3'
$bucket = "SAMPLES3BUCKETNAME"
$key = 'test.xlsx'
$region = 'ap-southeast-1'
$host1 = $bucket + '.s3-' + $region + '.amazonaws.com'
$access_key = 'SAMPLEACCESSKEY'
$secret_key = 'SAMPLESECRETKEY'

function HmacSHA256($message, $secret)
{
    $hmacsha = New-Object System.Security.Cryptography.HMACSHA256
    $hmacsha.key = $secret
    $signature = $hmacsha.ComputeHash([Text.Encoding]::ASCII.GetBytes($message))

    return $signature
}

function getSignatureKey($key, $dateStamp, $regionName, $serviceName)
{
    $kSecret = [Text.Encoding]::UTF8.GetBytes(("AWS4" + $key).toCharArray())
    $kDate = HmacSHA256 $dateStamp $kSecret;
    $kRegion = HmacSHA256 $regionName $kDate;
    $kService = HmacSHA256 $serviceName $kRegion;
    $kSigning = HmacSHA256 "aws4_request" $kService;

    return $kSigning
}

function hash($request)
{
    $hasher = [System.Security.Cryptography.SHA256]::Create()
    $content = [Text.Encoding]::UTF8.GetBytes($request)
    $bytes = $hasher.ComputeHash($content)

    return ($bytes|ForEach-Object ToString x2) -join ''
}

$now = [DateTime]::UtcNow
$amz_date = $now.ToString('yyyyMMddTHHmmssZ')
$datestamp = $now.ToString('yyyyMMdd')

$signed_headers = 'host'
$credential_scope = $datestamp + '/' + $region + '/' + $service + '/' + 'aws4_request'

$canonical_querystring = 'X-Amz-Algorithm=AWS4-HMAC-SHA256'
$canonical_querystring += '&X-Amz-Credential=' + [uri]::EscapeDataString(($access_key + '/' + $credential_scope))
$canonical_querystring += '&X-Amz-Date=' + $amz_date
$canonical_querystring += '&X-Amz-Expires=86400'
$canonical_querystring += '&X-Amz-SignedHeaders=' + $signed_headers

$canonical_headers = 'host:' + $host1 + "`n"

$canonical_request = $method + "`n"
$canonical_request += "/" + $key + "`n"
$canonical_request += $canonical_querystring + "`n"
$canonical_request += $canonical_headers + "`n"
$canonical_request += $signed_headers + "`n"
$canonical_request += "UNSIGNED-PAYLOAD"

$algorithm = 'AWS4-HMAC-SHA256'

$canonical_request_hash = hash -request $canonical_request
$string_to_sign = $algorithm + "`n"
$string_to_sign += $amz_date + "`n"
$string_to_sign += $credential_scope + "`n"
$string_to_sign += $canonical_request_hash

$signing_key = getSignatureKey $secret_key $datestamp $region $service
$signature =  HmacSHA256 -secret $signing_key -message $string_to_sign
$signature = ($signature|ForEach-Object ToString x2) -join ''

$canonical_querystring += '&X-Amz-Signature=' + $signature

$request_url = "http://" + $host1 + "/" + $key + "?" + $canonical_querystring

Write-Host $request_url
Write to Profile File After Installing PowerShell Module with PowerShellGet

Write to Profile File After Installing PowerShell Module with PowerShellGet


By : esym
Date : March 29 2020, 07:55 AM
it helps some times As of PowerShell 3.0, a module is automatically imported when a command from the module is invoked. This was a brilliant on Microsoft's part; however, it did require that modules are located in a location where PowerShell looks for modules by default. Makes sense. You can see those locations by running the following command:
code :
$env:PSModulePath -split ';'
$PROFILE | Select-Object -Property *
$env:PSModulePath.GetType().Name
$env:PSModulePath += ';C:\Another\Path'
Installing an MSI file on a remote machine with PowerShell

Installing an MSI file on a remote machine with PowerShell


By : Johe
Date : March 29 2020, 07:55 AM
wish helps you I'm working on a utility to automate some processes and one task is to install a .msi file on a remote machine. The file is found in C:\Users\username on the remote machine and for simplicity's sake, the filename is file.msi. The command I'm using is: , Ideally, this should work.
code :
Invoke-Command -ComputerName $remoteMachine -ScriptBlock{msiexec /i $installPath /quiet}
Invoke-Command -ComputerName $remoteMachine -ScriptBlock{
param(
    [Parameter(Mandatory=$true,
                   Position=0)]
    $installPath
    )
cmd /c start /wait msiexec /i $installPath /quiet
} -ArgumentList $installPath
Invoke-Command -ComputerName $remoteMachine -ScriptBlock{C:\Users\Username\Install.bat}
Related Posts Related Posts :
  • Malware Using .Lnk file to Powershell
  • Powershell Foreach-Object Foreach loop read string from several files and write to one
  • Method Invocation failed system.string error
  • Script to move folders with specific names and characters
  • Azure blob download is incredibly slow using PowerShell (via Get-AzureStorageBlobContent), but fast via Azure Explorer,
  • Is there a way in Powershell to append or prepend the value of a variable to the output of a piplined command
  • How do I pass raw strings to commands through the command line in PowerShell?
  • Converting Get-ChildItem output to string[]
  • Compress-Archive powershell command not known in windows 7
  • Adding a newline (line break) to a Powershell script
  • Import-Csv of huge (13M Rows) filtered using Where-Object with 11k rows
  • Trouble with Expanding $Env:TEMP in start-process MSIEXEC
  • 'New-AzureStorageContext' is not recognized
  • How can I set the Cache-Control when using Write-S3Object?
  • Powershell script not exiting while running via freeSSHd
  • Dot Source a "script" within a Function
  • Powershell script to create website in IIS
  • Update IIS 6 WebSite Credentials via powershell
  • Change initial directory in windows powershell
  • Launching Internet Explorer from a PowerShell script
  • How to call .cmd file as administrator?
  • Task Scheduler with powershell not working
  • Error connecting to Azure VM with VS Online Build Server / Release Management
  • PowerShell grab plaintext from URL and use as variable
  • How to quickly check if WMI information can be pulled from a remote computer
  • Putting a specific Powershell Get-Counter Statistic into a variable
  • Nonewline messes up output for Powershell
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org