Common Tasks in VBScript


You are probably familiar with the VBScript items listed below. Therefore, we'll quickly point out how to do nearly the same thing in PowerShell:

  • WScript.Echo. For producing output to the command-line, use the Write-Host cmdlet.

  • MsgBox(), InputBox(). No direct analog in PowerShell since it's intended to be entirely command-line. Use the Read-Host cmdlet to accept input from the command-line.

  • WMI. Use Get-WMIObject.

  • Working with text files. Refer to Chapter 12. Several PowerShell cmdlets are available to manipulate text files. The basic technique is to read the entire file into an object and then enumerate through each line of the file as a child object.

  • ADSI. Tricky because there's not a direct equivalent in PowerShell v1. However, refer to the discussion earlier in this chapter for information on how to work with ADSI.

  • Working with the registry. Review Chapter 12 for more information. PowerShell provides a registry "drive" and cmdlets for working with the registry.



Windows PowerShell. TFM
Internet Forensics
ISBN: 982131445
EAN: 2147483647
Year: 2004
Pages: 289

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net