Exception error Calling

Asked

Viewed 38 times

0

Good morning

I’m trying to run the powershell script https://github.com/the-xentropy/xencrypt/blob/master/xencrypt.ps1 and both the script and the file I’m trying to encrypt are on the same board

the steps I followed were

Import-Module ./xencrypt.ps1
Invoke-Xencrypt -InFile test.ps1 -OutFile testcrypted.ps1

but gave me the error

Invoke-Xencrypt : Exception calling "ReadAllBytes" with "1" argument(s): "Não foi possível localizar o ficheiro
'C:\Users\DESKTOP\test.ps1'."
At line:1 char:1
+ Invoke-Xencrypt -InFile test.ps1 -OutFile testcrypted.ps1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Invoke-Xencrypt], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException,Invoke-Xencrypt

Why is this happening?

Thank you

1 answer

0


Include the rest of the directory next to the file name:

$curPath = (Get-Location).Path
$inFile = $curPath + "\test.ps1"
$outFile = $curPath + "\testcrypted.ps1"

Import-Module ./xencrypt.ps1
Invoke-Xencrypt -InFile $inFile -OutFile $outFile
  • Thank you for your reply I do PS C:\Users\IEUser\desktop> $curPath = (Get-Location).Path PS C:\Users\IEUser\desktop> $inFile = $curPath + "\test.ps1" PS C:\Users\IEUser\desktop> $outFile = $curPath + "\testcrypted.ps1" PS C:\Users\IEUser\desktop> Import-Module ./xencrypt.ps1 PS C:\Users\IEUser\desktop> Invoke-Xencrypt -InFile $file -OutFile $outFile but I get

  • The variable '$file' cannot be retrieved because it has not been set. At line:1 char:25 + Invoke-Xencrypt -Infile $file -Outfile $outfile + ~~~~~ + Categoryinfo : Invalidoperation: (file:String) [], Parentcontarroinserrecordexception + Fullyqualifiederrorid : Variableisundefined

  • There was a typo in the Answer... just updated it, check it Again.

  • Getting the error 'Invoke-Xencrypt : Exception Calling "Readallbytes" with "1" argument(s): "Could not find file 'C: users ieuser desktop test.ps1'." At line:1 char:1 + Invoke-Xencrypt -Infile $infile -Outfile $outfile + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Categoryinfo : Notspecified: (:) [Invoke-Xencrypt], Methodinvocationexception + Fullyderrorid : Filenotfoundexception,Invoke-Xencrypt'

  • Try to run it as administrator

  • Thank you very Much. It worked

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.