Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Moving certs between stores using powershell v3

$
0
0

Hello,

I'm trying to write a script that will test to see if a particular certificate is there and if so move it to the disallowed store.  I've written this script but I can't figure out why it's not working.  No errors are returned but it just doesn't do anything.  Any help would be appreciated.

# requires -version 3
$servername = Hostname
$file = get-childitem Cert:\LocalMachine\AuthRoot | where {$_.thumbprint -eq '4EB6D578499B1CCF5F581EAD56BE3D9B6744A5E5'}
$trusted_path = "cert:\localmachine\authroot"
$Untrusted_path = "cert:\localmachine\disallowed"


if (Test-Path -path $trusted_path)
    {
    Move-item "cert:\localmachine\authroot\$file" -destination $untrusted_path -Force
    }
Else
    {
     write-host "The certificate is not in the AuthRoot Folder on server $servername"
    }

Thanks...


Jeff Stewart


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>