how to generate a csr with multiple OU fields using certreq - csr

How can generate a csr file using Microsoft certreq tool by specifying more than 1 OU
what would be format on req.inf file?
i tried giving multiple OU's however it takes whatever is given first.

Related

Add list of files to a command

I am not expert on PowerShell so just trying to find way here
I am trying to get a list of files added to a command.
I have a folder full of certs
cert1.p12
cert2.p12
cert3.p12
How do I get these files listed for my command bellow and separated by comma?
CertUtil -p "password1","password2" -MergePFX -user cert1.p12,cert2.p12,cert3.p12 certificate.pfx
Tried searching for a command to add to a straight line with separation

Is there a way to combine Microsoft Serialized Certificate Store (SST) Files?

I am trying to import multiple certificates to Outlook365 so that the Outlook web client will trust those S/MIME certificates. For reference, the command I'm using to import the SST file to Outlook365 is as follows:
Set-SmimeConfig -SMIMECertificateIssuingCA (Get-Content C:\Users\chaos\OneDrive\Documents\Personal\Folders\keys\AllImportantKeys.sst -Encoding Byte)
However, this command appears to replace the key store with the contents of the SST file, rather than appending the keys in the SST file.
The problem is that you can only export multiple certificates to an SST file if they are in the same folder in the Windows Certificate Manager. So, if you want to create an SST file that contains multiple certificates in multiple folders (for example, Current User\Personal\Certificates and Current User\Trusted Root Certification Authorities\Certificates), you are out of luck.
I have exported the certificates I need from four folders to four separate SST files. Is there a way to combine or merge them? I tried a simple file concatenation with Get-Content piped into Set-Content, but I get a bad format error when trying to import the SST file to Outlook365.
If SST files can't be easily combined, is there another workaround? For example, a way to force Outlook365 to append rather than replace? Or, a way to export all the keys I need at once (from multiple folders) to the SST file?
Thanks!
So, I figured out that Get-Content can accept a comma-delimited list of files. So, I was able to load multiple SST files into the Outlook365 store by simply doing this:
Set-SmimeConfig -SMIMECertificateIssuingCA (Get-Content C:\Keys1.sst, C:\Keys2.sst, C:Keys3.sst -Encoding Byte)

adding SSL automation task to pipeline

I've created a power shell script that sets the SSL based on a provided PFX file.
Using the VSTS pipeline, what is the recommended way of passing PFX file to the script?
Including PFX file in a solution
getting the PFX file path on a target environment (contains dependency,
assuming that PFX file is already placed on target environment)
any other solution...?
The common way to pass authentication to the script is using option 1 (Including PFX file in a solution) as you listed.
After adding the pfx file into your solution, you can import certificates and private keys by import-PfxCertificate.
Detail usage and examples of Import-PfxCertificate, you can refer this document.

Signing a folder and/or contents with OpenSLL error

I have written a Powershell script that reads the contents of a USB drive, reads files one by one and signs them in turn, generating a corresponding .sha256 file for each one.
I am having trouble getting this to either read files within subfolders or just to sign the folders on the root.
The command I am using to sign files is as follows;
C:\openssl\openssl.exe dgst -sha256 -sign $PriKey -out $path"\"$file".sha256" -passin pass:<passowrd> $path"\"$file
When it gets to a folder, it gives a 'Permission Denied' error (The user is a full administrator with full access to everything).
Does anyone know how I can get OpenSSL to either sign a folder (I realise folders are not conventional files) or to have Powershell read the contents of subfolders and sign the files contained there as per above?
I am relatively new to both.
Regards,
Jose

How to delete a empty row from a csv file using PowerShell

I need to delete multiple empty rows (;;;;;;;) from a csv file using PowerShell.
I wrote a PowerShell script that I use to creating new users in active directory. The csv file is created by using excel. Sometimes there are empty rows in the CSV file. The script is automatically deployed using task scheduler so I can’t check the script every day that’s why I really need PowerShell to clean the csv automatically.
I also want PowerShell to deletes all the contents from the CSV file when the user has been created. (End of the script)
Thx for the help