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

NotImplementedException - The method or operation is not implemented

Closed Thread
 
Thread Tools Display Modes
Old 05-13-2008   #1 (permalink)
steven acer
Guest


 

NotImplementedException - The method or operation is not implemented

i jusy downloaded PowerShell CTP 2.0 and I'm fairly new to it so bare
with me please.

i'm getting a
"System.NotImplementedException
The method or operation is not implemented"

while trying the following piece of code
[System.Reflection.Assembly]::Load("System.Xml, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089")
trap [Exception]{
write-host
write-error $("TRAPPED: " + $_.Exception.GetType().FullName);
write-error $("TRAPPED: " + $_.Exception.Message);
continue;
}
$xmlDoc=new-object System.Xml.XmlDocument
$xmlDoc.PreserveWhitespace = true;
$xmlDoc.Load("D:\Stuff\Other Files\create.xml");
$xmlSignElt=$xmlDoc.GetElementsByTagName("sign") # statement on which
it's choking

...
I assume,from the exception message that the GetElementsByTagName is
not implemented in PowerShell but how come i can use other functions
from the same class this method exists in ?
Aren't all the .NET namespaces available for use inside PS scripts?
If not, how do i know which methods are available and which are not?
i'm using .NET 2.0
Old 05-13-2008   #2 (permalink)
Marco Shaw [MVP]
Guest


 

Re: NotImplementedException - The method or operation is not implemented

Quote:

> $xmlDoc.PreserveWhitespace = true;
This should be "= $true" and not "= true". Please change and retry
and/or provide your create.xml contents for us to test if you can.

Marco

--
Microsoft MVP - Windows PowerShell
http://www.microsoft.com/mvp

PowerGadgets MVP
http://www.powergadgets.com/mvp

Blog:
http://marcoshaw.blogspot.com
Old 05-14-2008   #3 (permalink)
steven acer
Guest


 

Re: NotImplementedException - The method or operation is notimplemented

On May 13, 5:03 pm, "Marco Shaw [MVP]" <marco.shaw@_NO_SPAM_gmail.com>
wrote:
Quote:
Quote:

> > $xmlDoc.PreserveWhitespace = true;
>
> This should be "= $true" and not "= true". Please change and retry
> and/or provide your create.xml contents for us to test if you can.
>
> Marco
>
> --
> Microsoft MVP - Windows PowerShellhttp://www.microsoft.com/mvp
>
> PowerGadgets MVPhttp://www.powergadgets.com/mvp
>
> Blog:http://marcoshaw.blogspot.com

it's working now sorry my mistake, it was breaking while trying to
access the XmlNodeList , i apparently was doing it the wrong way
i'm having another exception now, first let me explain what i'm
trying to do . My target is to encypt some elements of an XML file
with an asymetric key.

if ($elementToEncrypt -eq $null){
throw (new-object System.Xml.XmlException("The specified
element was not found"))

}
$sessionKey = $null

#Create a 256 bit Rijndael key.
$sessionKey = new-object System.Security.Cryptography.RijndaelManaged
$sessionKey.KeySize = 256

$edElement = new-object System.Security.Cryptography.Xml.EncryptedData
write-host $("elementToEncrypt is null? " + ($elementToEncrypt -eq
$null))
$encryptedXml = new-object
System.Security.Cryptography.Xml.EncryptedXml
$encryptedElement = $encryptedXml.EncryptData($elementToEncrypt,
$sessionKey, $false)

write-host $("encryptedElement is null? " + ($encryptedElement -eq
$null))

$edElement.Type = $encryptedXml.XmlEncElementUrl
$edElement.Id = $EncryptionElementID


$edElement.EncryptionMethod = new-object
System.Security.Cryptography.Xml.EncryptionMethod($encryptedXml.XmlEncAES256Url);
# Encrypt the session key and add it to an EncryptedKey element.
$ek = new-object System.Security.Cryptography.Xml.EncryptedKey

[byte[]] $encryptedKey =
[System.Security.Cryptography.Xml.EncryptedXml]::EncryptKey($sessionKey.Key,
$Alg, $false);

$ek.CipherData = new-object
System.Security.Cryptography.Xml.CipherData($encryptedKey);

and the last line is giving the following error when executed
"Cannot find an overload for ".ctor" and the argument count: "128"."

by the way i had to work my brains out into finding the line spitting
the error since the error message and the StackTrace do not mention it
as far as i saw
thanks again.
Oh one more thing! Is there an editor,preferably a free one, other
than VS that i can use for writing PS scripts. I tried using the PS
Graphical editor but it's nothing more than a syntax coloring tool and
an execution environment.
Old 05-14-2008   #4 (permalink)
Marco Shaw [MVP]
Guest


 

Re: NotImplementedException - The method or operation is not implemented

Honestly, what you're doing is a bit beyond what I currently understand.
Quote:

> $ek.CipherData = new-object
> System.Security.Cryptography.Xml.CipherData($encryptedKey);
>
> and the last line is giving the following error when executed
> "Cannot find an overload for ".ctor" and the argument count: "128"."

http://msdn.microsoft.com/en-us/libr...ipherdata.aspx

How are you defining $encryptedkey? You don't have that part in your post.
Quote:

> Oh one more thing! Is there an editor,preferably a free one, other
> than VS that i can use for writing PS scripts. I tried using the PS
> Graphical editor but it's nothing more than a syntax coloring tool and
> an execution environment.
There are a few. What features are you looking for exactly?

Marco
Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
WOW! try/catch/finally has been implemented and will be available in next drop. Roman Kuzmin PowerShell 5 04-02-2008 08:06 PM
Method invocation failed because [System.String] doesn't contain a method B Williams PowerShell 0 03-31-2008 06:00 PM
Autosave in Spider Solitaire incorrectly implemented Leighton Vista Games 0 11-15-2007 09:59 AM
HTTP 501 Not Implemented RRTest Vista General 2 03-10-2007 09:34 AM
OT: Why Aero was implemented on 3D? Fernando Vista General 9 07-27-2006 05:43 PM








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