locked
Need help! RRS feed

  • Question

  • Hi,

    I am new to Powershell. Recently I need to schedule a customized WSUS report and I found this online.

    https://social.technet.microsoft.com/wiki/contents/articles/34635.powershell-generating-wsus-reports.aspx 

    I copied the code and saved as WSUSReport.ps1 file. Below is the output after I ran it.

    PS E:\Report> .\WSUSReport.ps1
    At E:\Report\WSUSReport.ps1:18 char:74
    + 018.$myWindowsID=[System.Security.Principal.WindowsIdentity]::GetCurrent()
    +                                                                          ~
    An expression was expected after '('.
    At E:\Report\WSUSReport.ps1:24 char:5
    + 024.{
    +     ~
    Unexpected token '{' in expression or statement.
    At E:\Report\WSUSReport.ps1:26 char:6
    + 026. $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Elevate ...
    +      ~~~~~
    Unexpected token '$Host' in expression or statement.
    At E:\Report\WSUSReport.ps1:27 char:6
    + 027. $Host.UI.RawUI.BackgroundColor = "DarkBlue"
    +      ~~~~~
    Unexpected token '$Host' in expression or statement.
    At E:\Report\WSUSReport.ps1:28 char:6
    + 028. clear-host
    +      ~~~~~~~~~~
    Unexpected token 'clear-host' in expression or statement.
    At E:\Report\WSUSReport.ps1:31 char:5
    + 031.{
    +     ~
    Unexpected token '{' in expression or statement.
    At E:\Report\WSUSReport.ps1:34 char:6
    + 034. $newProcess = new-object System.Diagnostics.ProcessStartInfo "PowerShell";
    +      ~~~~~~~~~~~
    Unexpected token '$newProcess' in expression or statement.
    At E:\Report\WSUSReport.ps1:36 char:6
    + 036. $newProcess.Arguments = $myInvocation.MyCommand.Definition + " -Step $Step" ...
    +      ~~~~~~~~~~~
    Unexpected token '$newProcess' in expression or statement.
    At E:\Report\WSUSReport.ps1:38 char:6
    + 038. $newProcess.Verb = "runas";
    +      ~~~~~~~~~~~
    Unexpected token '$newProcess' in expression or statement.
    At E:\Report\WSUSReport.ps1:40 char:6
    + 040. [System.Diagnostics.Process]::Start($newProcess);
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Unexpected token '[System.Diagnostics.Process]::Start' in expression or statement.
    Not all parse errors were reported.  Correct the reported errors and try again.
        + CategoryInfo          : ParserError: (:) [], ParseException
        + FullyQualifiedErrorId : ExpectedExpression

    PS E:\Report>

    I don't understand what this mean. I need help! 

    Thanks in advance!


    Grace

    Monday, October 30, 2017 11:54 PM