INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Need Help!

Need Help!

(OP)
Hi Guys,

I badly need help regarding the script I am creating. (i am really not a scripter).

I have this script below to request a certificate from my CA server. This script will request a certificate up to the Nth user and export the certs as well as the private key to a local folder.

However, upon checking the certificate, the "Subject" is not what I desired to be (ssotest00x) and becomes the current user who ran the script.

I know there should be a way to do this and the ides are coming in but I can't still figure out what to do..

Need help:)


#Read the instructions document before running.
New-Item C:\Certificates-temp-folder -type directory -Force
cd C:\Certificates-temp-folder

for ($i=1;$i -le 2; $i++)
{
Add-Content C:\Certificates-temp-folder\req$i.inf "[NewRequest]`r`nSubject=`"cn=ssotest00$i,O=XXXX-XX,C=US`"`r`nRequestType=pkcs10`r`n`r`n[RequestAttributes]`r`nCertificateTemplate=SSOUserNew`r`n`r`n[Extensions]`r`n2.5.29.17 = `"{text}`"`r`n_continue_=`"EMail=ssotest00$i@test.com`""
certreq -new req$i.inf certnew$i.req
certreq -submit -config "ssoserver\SSO_CA" certnew$i.req certnew$i.cer
certreq -accept certnew$i.cer
certutil -privatekey -p "ssotest00$i" -exportpfx -user ssotest00$i@test.com ssotest00$i.p12
#del C:\Certificates-temp-folder\req$i.inf
#del C:\Certificates-temp-folder\certnew$i.req
#del C:\Certificates-temp-folder\certnew$i.cer

}


Thanks in advance.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close