Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

Newbie

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 08-03-2007   #1 (permalink)
mosfet
Guest


 

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 SpecsSystem Spec
Old 08-03-2007   #2 (permalink)
RichS
Guest


 

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 SpecsSystem Spec
Old 08-03-2007   #3 (permalink)
mosfet
Guest


 

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 SpecsSystem Spec
Old 08-03-2007   #4 (permalink)
RichS
Guest


 

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 SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Newbie needs help Fiddy General Discussion 4 03-08-2008 04:53 PM
Newbie Avo General Discussion 4 02-20-2008 06:30 AM
Newbie - WLM PvdG42 Live Mail 3 12-20-2007 03:31 PM
Help a newbie brhessel PowerShell 6 05-23-2007 12:12 PM
Newbie: Help me OUT =?Utf-8?B?S2FseWFu?= PowerShell 2 08-27-2006 09:36 AM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51