![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Newbie Hi, I would like to run the following script : # CertificateStore template for adding a ROOT cert $certAddString = @" <wap-provisioningdoc> <characteristic type="CertificateStore"> <characteristic type="ROOT"> <characteristic type="{0}"> <parm name="EncodedCertificate" value=" {1} "/> </characteristic> </characteristic> </characteristic> </wap-provisioningdoc> "@ # Load in a .CER file from the command line $cert = get-pfxcertificate $args[0] # get the thumbprint $certHash = $cert.GetCertHashString() # Convert the encoded blob to base64 text $encodedCertificate = [Convert]::ToBase64String($cert.GetRawCertData()) # print those into our WAP xml template $outXml = $certAddString -f ($certHash, $encodedCertificate) # finished - write the XML to the outbound pipeline write-object $outXml But I get the following error (french-translated below) PS C:\_VOXMOBILI_MON_PACKAGING\Common>C:\_VOXMOBILI_MON_PACKAGING\Common\Gen_Pre_XML.PS1 Voxmobili.cer Le terme « write-object » n'est pas reconnu en tant qu'applet de commande, fonction, programme exécutable ou fichier de script. Vérifiez le terme et réessayez. PS C:\_VOXMOBILI_MON_PACKAGING\Common>C:\_VOXMOBILI_MON_PACKAGING\Common\Gen_Pre_XML.PS1 Voxmobili.cer « write-object » term is not recognized as cmdlet ... |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Newbie The error message is because there isn't a cmdlet called write-object within PowerShell Where are you trying to write the information to? -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "mosfet" wrote: > Hi, > > I would like to run the following script : > > # CertificateStore template for adding a ROOT cert > $certAddString = @" > <wap-provisioningdoc> > <characteristic type="CertificateStore"> > <characteristic type="ROOT"> > <characteristic type="{0}"> > <parm name="EncodedCertificate" value=" > {1} > "/> > </characteristic> > </characteristic> > </characteristic> > </wap-provisioningdoc> > "@ > > # Load in a .CER file from the command line > $cert = get-pfxcertificate $args[0] > > > # get the thumbprint > $certHash = $cert.GetCertHashString() > > # Convert the encoded blob to base64 text > $encodedCertificate = [Convert]::ToBase64String($cert.GetRawCertData()) > > # print those into our WAP xml template > $outXml = $certAddString -f ($certHash, $encodedCertificate) > > # finished - write the XML to the outbound pipeline > write-object $outXml > > > But I get the following error (french-translated below) > > PS > C:\_VOXMOBILI_MON_PACKAGING\Common>C:\_VOXMOBILI_MON_PACKAGING\Common\Gen_Pre_XML.PS1 > Voxmobili.cer > > Le terme « write-object » n'est pas reconnu en tant qu'applet de > commande, fonction, programme exécutable ou fichier de > script. Vérifiez le terme et réessayez. > > > PS > C:\_VOXMOBILI_MON_PACKAGING\Common>C:\_VOXMOBILI_MON_PACKAGING\Common\Gen_Pre_XML.PS1 > Voxmobili.cer > > « write-object » term is not recognized as cmdlet ... > > > > > |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Newbie RichS a écrit : > The error message is because there isn't a cmdlet called write-object within > PowerShell > > Where are you trying to write the information to? Actually I want to write the result into a file so finally I did this : PS C:\_VOXMOBILI_MON_PACKAGING\Common>C:\_VOXMOBILI_MON_PACKAGING\Common\Gen_Pre_XML.PS1 Voxmobili.cer > mycert.xml I have used the > redirection operator but how could I do the same by code ? And in my script # CertificateStore template for adding a ROOT cert $certAddString = @" <wap-provisioningdoc> <characteristic type="CertificateStore"> <characteristic type="ROOT"> <characteristic type="{0}"> <parm name="EncodedCertificate" value=" {1} "/> </characteristic> </characteristic> </characteristic> </wap-provisioningdoc> "@ # Load in a .CER file from the command line $cert = get-pfxcertificate $args[0] # get the thumbprint $certHash = $cert.GetCertHashString() # Convert the encoded blob to base64 text $encodedCertificate = [Convert]::ToBase64String($cert.GetRawCertData()) # print those into our WAP xml template $outXml = $certAddString -f ($certHash, $encodedCertificate) # finished - write the XML to the outbound pipeline write-object $outXml Another question : when using > redirection , resulting file is UTF-16 encoded how can I save the output stream in UTF-8 ? |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Newbie set-content may well be what you want or out-file -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "mosfet" wrote: > RichS a écrit : > > The error message is because there isn't a cmdlet called write-object within > > PowerShell > > > > Where are you trying to write the information to? > Actually I want to write the result into a file so finally I did this : > > PS > C:\_VOXMOBILI_MON_PACKAGING\Common>C:\_VOXMOBILI_MON_PACKAGING\Common\Gen_Pre_XML.PS1 > Voxmobili.cer > mycert.xml > > > I have used the > redirection operator but how could I do the same by code ? > > And in my script > # CertificateStore template for adding a ROOT cert > $certAddString = @" > <wap-provisioningdoc> > <characteristic type="CertificateStore"> > <characteristic type="ROOT"> > <characteristic type="{0}"> > <parm name="EncodedCertificate" value=" > {1} > "/> > </characteristic> > </characteristic> > </characteristic> > </wap-provisioningdoc> > "@ > > # Load in a .CER file from the command line > $cert = get-pfxcertificate $args[0] > > > # get the thumbprint > $certHash = $cert.GetCertHashString() > > # Convert the encoded blob to base64 text > $encodedCertificate = [Convert]::ToBase64String($cert.GetRawCertData()) > > # print those into our WAP xml template > $outXml = $certAddString -f ($certHash, $encodedCertificate) > > # finished - write the XML to the outbound pipeline > write-object $outXml > > Another question : when using > redirection , resulting file is UTF-16 > encoded how can I save the output stream in UTF-8 ? > > > > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Newbie help | Gaming | |||
| Re: WLM newbie | Live Mail | |||
| Newbie | PowerShell | |||
| newbie | VB Script | |||
| Newbie needs help | General Discussion | |||