Forum Discussion

Scott_Stockton's avatar
3 years ago

We have many Arrays and I would love this script to

We have many Arrays and I would love this script to work but it doesn't: Import-Csv c:\temp\AllArrays2.csv Foreach ($Array in $Arrays) { New-PfaNamedCertificateSigningRequest -Array $Array -CertificateName management -CommonName $FQDN -Country US -Email $email -Organization $org -OrganizationalUnit Infrastructure -State $State -Locality $city }
  • Can you post the error? You have to connect to the array first with new-pfaarray and use the object that is returned as input into subsequent SDK calls. So in your loop, connect to the array with new-pfaarray and send that return into a variable $objArray for example. Then use $objArray as input to the array parameter for New-pfanamedcertificatesigningrequest. For the sake of session management, you can add a disconnect before your next iteration of the loop.
  • certificate_signing_request --------------------------- -----BEGIN CERTIFICATE REQUEST-----.
  • Here is exactly what I typed: $myCredential = Get-Credential $array = "dna-pure-01" #Add all the Arrays Needed Import-Module PureStoragePowerShellSDK New-PfaArray -EndPoint $array -Credentials $myCredential -IgnoreCertificateError | New-PfaNamedCertificateSigningRequest -CertificateName management -CommonName http://dna-pure-01.polsinelli.law|dna-pure-01.polsinelli.law -Country US -Email mailto:storageadmin@polsinelli.com|storageadmin@polsinelli.com -Organization 'Polsinelli P.C.' -OrganizationalUnit Infrastructure -State KS -Locality Lenexa -Confirm
  • any chance it is a piping problem? i didnt think our SDK1 properly supported piping variables. but i feel like that would spit out a clear error...so maybe not.
  • So that is not outputting a string, but rather an object…. so Assign your request to a variable, then use that property to display the full CSR string