PowerShell icon indicating copy to clipboard operation
PowerShell copied to clipboard

Cascading Failure To Find Tmp/Req Files After First Export

Open iriecolorado opened this issue 2 years ago • 1 comments

First certificate in the .csv chain executes perfectly. Every fourth certificate in the csv chain executes perfectly. All other entries in the chain fail to submit because they "Certificate Request Processor: The system cannot find the file specified. 0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND)" can't find the .tmp file. Looking in %LOCALAPPDATA%\Temp the requisite .tmp file for the request is not present. Every 3rd certificate request in the .csv opens an explorer window.

Presented with a CSV of:

CN S2TESTR001 S2TESTR002 S2TESTR003 S2TESTR004 S2TESTR005 S2TESTR006 S2TESTR007 S2TESTR008 S2TESTR009 S2TESTR010 S2TESTR011 S2TESTR012 S2TESTR013 S2TESTR014 S2TESTR0015

the 1st, 5th, 9th, and 13th (every fourth) execute, all of the others inbetween fail with '.tmp' not found.

Import-Csv .\file.csv -UseCulture | .\Request-Certificate.ps1 -verbose -TemplateName "MyCustomMachineTemplate" -Export -ExportPath "C:\TEMP" -Password "password" -CAName "ca.myserver.com\MYCANAME"

iriecolorado avatar Aug 17 '22 20:08 iriecolorado

I can confirm, same issue here. Please use the fix below, it resolves the issue: https://github.com/J0F3/PowerShell/issues/18#issue-775865274

UU0113 avatar Mar 05 '24 16:03 UU0113