Gotcha : PowerShell questions


                    Le Café Central de
Deva              

                                 
                                 ..... Deva blogs!!




 

 

Gotcha : PowerShell questions

  • Comments 1

I composed couple of Windows PowerShell questions:

Can you create your own PowerShell object?

We can write a Cmdlet, but we have to do that with a .NET Framework language such as C# or VB.NET.

Can we create a.BAT file using PowerShell?

No. But we can create PowerShell scripts, which have a .PS1 file extension

Can we run a .VBS file natively run in PowerShell?

No, we can't.

Can we work PowerShell against remote systems? If so how?

PS 1.0 will not work against remote systems. However, we can call WMI or .NET Framework and use them to run against remote machines.

How can we sign a script?

Same as signing any code

Can you run more than one copy of PowerShell at the same time?

Yes.

Will I need to know PowerShell to administer Exchange 2007?

Yes we can manage Exchange from the command prompt or by using scripts. Also we can still do it by using the GUI-based management of Exchange without knowing PowerShell.

How do you find all the namespaces available in PowerShell?

Get-PSProvider will list all the PowerShell providers and Get-PSDrive will list all the drives currently mapped to the namespaces surfaced by those providers.

  • Two things caught my eye as being wrong answers.

    One: can you create your own Powershell object?

    PS team worked hard to allow us to do this

    $obj = new-object PSObject

    $obj | add-member noteproperty PropA ... etc

    Two: can you execute VBS code natively?

    I would like to claim as a yes via .Net interop. VBS engine can be called via

    $vbEngine = new-object -com MSScriptControl.ScriptControl

    $vbEngine.language = "vbscript"

    $vbEngine.addcode(<vb code as a string>)

    $vbEngine.eval(..)

Page 1 of 1 (1 items)
Blog - Post Feedback Form(CAPTCHA)
Leave a Comment
  • Post