Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - New-Object -ComObject x -Strict - A very good idea

Reply
 
Old 06-15-2006   #1 (permalink)
Alex K. Angelopoulos [MVP]


 
 

New-Object -ComObject x -Strict - A very good idea

I just noticed the -Strict SwitchParameter added to the ComObject parameter
set for New-Object. I like. It's nice to get a warning when PowerShell runs
into .NET wrapping behavior that might cause problems for scripters.



My System SpecsSystem Spec
Old 06-19-2006   #2 (permalink)
Arul Kumaravel[MSFT]


 
 

Re: New-Object -ComObject x -Strict - A very good idea

Yes, That is exactly the reason why we created the strict switch. We found
it hard to determine when we are getting COM object and .Net object. Often
times, script fails in a location Using this switch, you will get COM
object. if you get RCW class, new-object will fail. This makes it easy to
identify the issue earlier in the script than later.

--
Arul Kumaravel [MSFT]
Development Manager,
Windows PowerShell,
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights

"Alex K. Angelopoulos [MVP]" <a k a @ m v p s . o r g> wrote in message
news:OlQZqlNkGHA.1264@TK2MSFTNGP05.phx.gbl...
>I just noticed the -Strict SwitchParameter added to the ComObject parameter
>set for New-Object. I like. It's nice to get a warning when PowerShell runs
>into .NET wrapping behavior that might cause problems for scripters.
>
>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Is It A Good Idea To Get An OS When It's New? Vista General
Multiple readyboost. Is that a good idea? Vista installation & setup
Autologon not such a good idea. Vista performance & maintenance
new-object -comobject "CAPICOM.Signed" failing on Win2k3? PowerShell
Can I use the uuid with new-object -comobject PowerShell


Vista Forums 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 Ltd

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