Powershell Command Line RRS feed

  • Question

  • OK I am very new to powershell.  I have a script started.  I need it to open a file for me then encrypt a file

    Here is the code


       $file =  'path to file to encrypt'
       $cert = 'path to key.asc'
       $out = 'dest path for encrypted file.gpg'

       $command = "C:\Program Files (x86)\GNU\GnuPG\kleopatra.exe"
       invoke-item $command {-i --import-certificate $cert -e --encrypt $file | Out-File }

    Below are the command line references for the program Kleopatra

    --uiserver-socket argument
    Location of the socket the ui server is listening on
    Run UI server only, hide main window
    -p --openpgp
    Use OpenPGP for the following operation
    -c --cms
    Use CMS (X.509, S/MIME) for the following operation
    -i --import-certificate
    Specifies a file or URL from which to import certificates (or secret keys) from.
    This is the command line equivalent of File!Import Certificates... (Ctrl+I) .
    -e --encrypt
    Encrypt file(s)
    -s --sign
    Sign file(s)
    -E --encrypt-sign
    Encrypt and/or sign file(s). Same as --sign-encrypt, do not use
    -d --decrypt
    Decrypt file(s)
    -V --verify
    Verify file/signature
    -D --decrypt-verify
    Decrypt and/or verify file(s)

    Can someone please help me create a script that will open Kloepatra and then encrypt the file for me and save it please

    Friday, September 2, 2016 1:07 PM