1

I am having trouble using the Unblock-File cmdlet. It will not unblock any file that I specify. Here is an example of what command I am trying to run

Unblock-File -Path "C:\test_file.txt"

First, I check my version of Powershell installed. Check.

PS C:\> $PSVersionTable.PSVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      16299  967

Second, I check sources here and here to make sure I have tried everything suggested to get the file to be unblocked.

I have:

  1. Tried running the Unblock-File cmdlet.

  2. Tried bypassing execution policy and running with an unrestricted execution policy.

  3. Checked file permissions and properties for the file, and all permissions are available.

  4. Removed foo.local from the pathname

  5. Ran -Stream Zone.Identifier, with no alternate streams found.

Still cannot run the file without a Security Warning popping up. What am I missing here?

PS: I do not have Admin rights to this computer.

EDIT: List of links to try to fix this problem with the New-SelfSignedCertificate -CloneCert $OldCert command:

http://www.herlitz.nu/2017/11/09/find-certificates-using-powershell/

https://learn.microsoft.com/en-us/powershell/module/pkiclient/new-selfsignedcertificate?view=win10-ps

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_signing?view=powershell-6

https://superuser.com/questions/174878/powershell-access-denied-to-cert-currentuser-my

https://www.reddit.com/r/PowerShell/comments/61yt7i/seeking_help_importing_certificates/

https://powershell.org/forums/topic/using-invoke-command-to-import-certificate-gives-access-denied/

medicine_man
  • 321
  • 3
  • 15
  • Unblocking a file doesn't get rid of a security prompt.. It allows you to run files downloaded from the Internet. If an executable isn't signed, it will always generate that warning. – Maximilian Burszley Mar 26 '19 at 15:31
  • So I have to basically *certify* any code I write in order for the message to dissappear? – medicine_man Mar 26 '19 at 15:33
  • If it's an executable, yes. If you have an internal CA, it shouldn't be too bad to deploy the public cert to your hosts and sign your executable through whatever IDE you're using. – Maximilian Burszley Mar 26 '19 at 15:34
  • Ok. I will have to research how to do that. Thank you for pointing me in the right direction. – medicine_man Mar 26 '19 at 15:38
  • I got a list of all certs on the computer, and tried the `New-SelfSignedCertificate -CloneCert $OldCert` command. Access Denied for every cert. I have about hit my limit, lol. – medicine_man Mar 28 '19 at 15:15

0 Answers0