|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
I found this on WSUS Site under Script Centre this Provides a status report for approved updates. Every update approved on your server is shown, with a list of the target groups for which it was approved. Within each group, counts are shown for how many computers have a specific status for that update: Installed, Needed, Failed, or Unknown. When I run this on the WSUS Server it gives me an error line 1 character: 87. Error: invalid character code: 800A0408 Source: Microsoft VBScript Compiling error I am not the scripting guy. Anybody can advise Please. Thank you [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Ad ministration") | out-null if (!$wsus) { $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); } "Server name: " +$wsus.Name; "Using secure connection: " + $wsus.IsConnectionSecureForRemoting; "Port number: " + $wsus.PortNumber; $updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScop e; $updateScope.UpdateApprovalActions = [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Install ` -bor [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Uninstall $wsus.GetUpdates($updateScope) | foreach { $update = $_ #$_ is a shorthand variable for the current item in a loop "--------------------------------------------------" "Update: " + $update.Title "Update Id: " + $update.Id.UpdateId "--------------------------------------------------" $wsus.GetComputerTargetGroups() | foreach { $group = $_ if ($update.GetUpdateApprovals($group).Count -ne 0) { #`t is equivalent to \t in C#/C++ "`t Computer Group: " + $group.Name "`t ComputerTargetGroupId: " + $group.Id "`t Approval action: " + $update.GetUpdateApprovals($group)[0].Action $summary = $update.GetSummaryForComputerTargetGroup($group) "`t Installed:" + ($Summary.InstalledCount + $summary.NotApplicableCount) $neededCount = ($summary.InstalledPendingRebootCount + $summary.NotInstalledCount) if ($neededCount -gt 0) { Write-Host ("`t Needed: $neededCount") -foregroundColor Yellow -backgroundColor black } else { "`t Needed: $neededCount" } if ($summary.FailedCount -gt 0) { Write-Host ("`t Failed: " + $summary.FailedCount) -foregroundColor Red -backgroundColor black } else { "`t Failed: " + $summary.FailedCount } "`t Unknown: " + $summary.UnknownCount "`t ------------------------------------------" } } "--------------------------------------------------" } |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
"WILDPACKET" wrote:
> > I found this on WSUS Site under Script Centre this > Provides a status report for approved updates. Every update approved on your > server is shown, with a list of the target groups for which it was approved. > Within each group, counts are shown for how many computers have a specific > status for that update: Installed, Needed, Failed, or Unknown. > > > > When I run this on the WSUS Server it gives me an error > > line 1 > character: 87. > Error: invalid character > code: 800A0408 > Source: Microsoft VBScript Compiling error > > > I am not the scripting guy. > > Anybody can advise Please. > > Thank you > > > > > > [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Ad ministration") | out-null > if (!$wsus) { > $wsus = > [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); > } > > "Server name: " +$wsus.Name; > "Using secure connection: " + $wsus.IsConnectionSecureForRemoting; > "Port number: " + $wsus.PortNumber; > > $updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScop e; > $updateScope.UpdateApprovalActions = > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Install ` > -bor > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Uninstall > > $wsus.GetUpdates($updateScope) | foreach { > $update = $_ #$_ is a shorthand variable for the current item in a loop > > "--------------------------------------------------" > "Update: " + $update.Title > "Update Id: " + $update.Id.UpdateId > "--------------------------------------------------" > > $wsus.GetComputerTargetGroups() | foreach { > $group = $_ > if ($update.GetUpdateApprovals($group).Count -ne 0) > { > #`t is equivalent to \t in C#/C++ > "`t Computer Group: " + $group.Name > "`t ComputerTargetGroupId: " + $group.Id > "`t Approval action: " + $update.GetUpdateApprovals($group)[0].Action > > $summary = $update.GetSummaryForComputerTargetGroup($group) > > "`t Installed:" + ($Summary.InstalledCount + $summary.NotApplicableCount) > > $neededCount = ($summary.InstalledPendingRebootCount + > $summary.NotInstalledCount) > if ($neededCount -gt 0) > { > Write-Host ("`t Needed: $neededCount") -foregroundColor Yellow > -backgroundColor black > } else { > "`t Needed: $neededCount" > } > > if ($summary.FailedCount -gt 0) > { > Write-Host ("`t Failed: " + $summary.FailedCount) -foregroundColor Red > -backgroundColor black > } else { > "`t Failed: " + $summary.FailedCount > } > > "`t Unknown: " + $summary.UnknownCount > "`t ------------------------------------------" > } > } > "--------------------------------------------------" > } > This looks like PowerShell, not VBScript. -- urkec |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Thank you urkec for your response. How do I excute this script? "urkec" wrote: > "WILDPACKET" wrote: > > > > > I found this on WSUS Site under Script Centre this > > Provides a status report for approved updates. Every update approved on your > > server is shown, with a list of the target groups for which it was approved. > > Within each group, counts are shown for how many computers have a specific > > status for that update: Installed, Needed, Failed, or Unknown. > > > > > > > > When I run this on the WSUS Server it gives me an error > > > > line 1 > > character: 87. > > Error: invalid character > > code: 800A0408 > > Source: Microsoft VBScript Compiling error > > > > > > I am not the scripting guy. > > > > Anybody can advise Please. > > > > Thank you > > > > > > > > > > > > [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Ad ministration") | out-null > > if (!$wsus) { > > $wsus = > > [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); > > } > > > > "Server name: " +$wsus.Name; > > "Using secure connection: " + $wsus.IsConnectionSecureForRemoting; > > "Port number: " + $wsus.PortNumber; > > > > $updateScope = new-object Microsoft.UpdateServices.Administration.UpdateScop e; > > $updateScope.UpdateApprovalActions = > > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Install ` > > -bor > > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Uninstall > > > > $wsus.GetUpdates($updateScope) | foreach { > > $update = $_ #$_ is a shorthand variable for the current item in a loop > > > > "--------------------------------------------------" > > "Update: " + $update.Title > > "Update Id: " + $update.Id.UpdateId > > "--------------------------------------------------" > > > > $wsus.GetComputerTargetGroups() | foreach { > > $group = $_ > > if ($update.GetUpdateApprovals($group).Count -ne 0) > > { > > #`t is equivalent to \t in C#/C++ > > "`t Computer Group: " + $group.Name > > "`t ComputerTargetGroupId: " + $group.Id > > "`t Approval action: " + $update.GetUpdateApprovals($group)[0].Action > > > > $summary = $update.GetSummaryForComputerTargetGroup($group) > > > > "`t Installed:" + ($Summary.InstalledCount + $summary.NotApplicableCount) > > > > $neededCount = ($summary.InstalledPendingRebootCount + > > $summary.NotInstalledCount) > > if ($neededCount -gt 0) > > { > > Write-Host ("`t Needed: $neededCount") -foregroundColor Yellow > > -backgroundColor black > > } else { > > "`t Needed: $neededCount" > > } > > > > if ($summary.FailedCount -gt 0) > > { > > Write-Host ("`t Failed: " + $summary.FailedCount) -foregroundColor Red > > -backgroundColor black > > } else { > > "`t Failed: " + $summary.FailedCount > > } > > > > "`t Unknown: " + $summary.UnknownCount > > "`t ------------------------------------------" > > } > > } > > "--------------------------------------------------" > > } > > > > This looks like PowerShell, not VBScript. > > -- > urkec |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
You will need to install powershell if it is not already installed. Then you
will need to rename the file containing the script from whatever.vbs to whatever.ps. And if that does not do the trick, then I'd suggest you refer back to the introductory material found at the Script Centre. /Al "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message news:905534C9-F422-47B7-9CDE-199E71507474@microsoft.com... > > Thank you urkec for your response. > How do I excute this script? > > > > "urkec" wrote: > >> "WILDPACKET" wrote: >> >> > >> > I found this on WSUS Site under Script Centre this >> > Provides a status report for approved updates. Every update approved on >> > your >> > server is shown, with a list of the target groups for which it was >> > approved. >> > Within each group, counts are shown for how many computers have a >> > specific >> > status for that update: Installed, Needed, Failed, or Unknown. >> > >> > >> > >> > When I run this on the WSUS Server it gives me an error >> > >> > line 1 >> > character: 87. >> > Error: invalid character >> > code: 800A0408 >> > Source: Microsoft VBScript Compiling error >> > >> > >> > I am not the scripting guy. >> > >> > Anybody can advise Please. >> > >> > Thank you >> > >> > >> > >> > >> > >> > [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Ad ministration") >> > | out-null >> > if (!$wsus) { >> > $wsus = >> > [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); >> > } >> > >> > "Server name: " +$wsus.Name; >> > "Using secure connection: " + $wsus.IsConnectionSecureForRemoting; >> > "Port number: " + $wsus.PortNumber; >> > >> > $updateScope = new-object >> > Microsoft.UpdateServices.Administration.UpdateScop e; >> > $updateScope.UpdateApprovalActions = >> > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Install >> > ` >> > -bor >> > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Uninstall >> > >> > $wsus.GetUpdates($updateScope) | foreach { >> > $update = $_ #$_ is a shorthand variable for the current item in a loop >> > >> > "--------------------------------------------------" >> > "Update: " + $update.Title >> > "Update Id: " + $update.Id.UpdateId >> > "--------------------------------------------------" >> > >> > $wsus.GetComputerTargetGroups() | foreach { >> > $group = $_ >> > if ($update.GetUpdateApprovals($group).Count -ne 0) >> > { >> > #`t is equivalent to \t in C#/C++ >> > "`t Computer Group: " + $group.Name >> > "`t ComputerTargetGroupId: " + $group.Id >> > "`t Approval action: " + $update.GetUpdateApprovals($group)[0].Action >> > >> > $summary = $update.GetSummaryForComputerTargetGroup($group) >> > >> > "`t Installed:" + ($Summary.InstalledCount + >> > $summary.NotApplicableCount) >> > >> > $neededCount = ($summary.InstalledPendingRebootCount + >> > $summary.NotInstalledCount) >> > if ($neededCount -gt 0) >> > { >> > Write-Host ("`t Needed: $neededCount") -foregroundColor Yellow >> > -backgroundColor black >> > } else { >> > "`t Needed: $neededCount" >> > } >> > >> > if ($summary.FailedCount -gt 0) >> > { >> > Write-Host ("`t Failed: " + $summary.FailedCount) -foregroundColor Red >> > -backgroundColor black >> > } else { >> > "`t Failed: " + $summary.FailedCount >> > } >> > >> > "`t Unknown: " + $summary.UnknownCount >> > "`t ------------------------------------------" >> > } >> > } >> > "--------------------------------------------------" >> > } >> > >> >> This looks like PowerShell, not VBScript. >> >> -- >> urkec |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Al Thanks for your response. I installed the Powershell and renamed it to file.ps I go to DOS prompt and type powershell and enter It changes the prompt to PS C:\> and then I type the file.ps and enter and get this error ... The term 'file.ps' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. At line:1 char:18 + file.ps <<<< Advise Please. "Al Dunbar" wrote: > You will need to install powershell if it is not already installed. Then you > will need to rename the file containing the script from whatever.vbs to > whatever.ps. And if that does not do the trick, then I'd suggest you refer > back to the introductory material found at the Script Centre. > > /Al > > "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message > news:905534C9-F422-47B7-9CDE-199E71507474@microsoft.com... > > > > Thank you urkec for your response. > > How do I excute this script? > > > > > > > > "urkec" wrote: > > > >> "WILDPACKET" wrote: > >> > >> > > >> > I found this on WSUS Site under Script Centre this > >> > Provides a status report for approved updates. Every update approved on > >> > your > >> > server is shown, with a list of the target groups for which it was > >> > approved. > >> > Within each group, counts are shown for how many computers have a > >> > specific > >> > status for that update: Installed, Needed, Failed, or Unknown. > >> > > >> > > >> > > >> > When I run this on the WSUS Server it gives me an error > >> > > >> > line 1 > >> > character: 87. > >> > Error: invalid character > >> > code: 800A0408 > >> > Source: Microsoft VBScript Compiling error > >> > > >> > > >> > I am not the scripting guy. > >> > > >> > Anybody can advise Please. > >> > > >> > Thank you > >> > > >> > > >> > > >> > > >> > > >> > [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Ad ministration") > >> > | out-null > >> > if (!$wsus) { > >> > $wsus = > >> > [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); > >> > } > >> > > >> > "Server name: " +$wsus.Name; > >> > "Using secure connection: " + $wsus.IsConnectionSecureForRemoting; > >> > "Port number: " + $wsus.PortNumber; > >> > > >> > $updateScope = new-object > >> > Microsoft.UpdateServices.Administration.UpdateScop e; > >> > $updateScope.UpdateApprovalActions = > >> > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Install > >> > ` > >> > -bor > >> > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Uninstall > >> > > >> > $wsus.GetUpdates($updateScope) | foreach { > >> > $update = $_ #$_ is a shorthand variable for the current item in a loop > >> > > >> > "--------------------------------------------------" > >> > "Update: " + $update.Title > >> > "Update Id: " + $update.Id.UpdateId > >> > "--------------------------------------------------" > >> > > >> > $wsus.GetComputerTargetGroups() | foreach { > >> > $group = $_ > >> > if ($update.GetUpdateApprovals($group).Count -ne 0) > >> > { > >> > #`t is equivalent to \t in C#/C++ > >> > "`t Computer Group: " + $group.Name > >> > "`t ComputerTargetGroupId: " + $group.Id > >> > "`t Approval action: " + $update.GetUpdateApprovals($group)[0].Action > >> > > >> > $summary = $update.GetSummaryForComputerTargetGroup($group) > >> > > >> > "`t Installed:" + ($Summary.InstalledCount + > >> > $summary.NotApplicableCount) > >> > > >> > $neededCount = ($summary.InstalledPendingRebootCount + > >> > $summary.NotInstalledCount) > >> > if ($neededCount -gt 0) > >> > { > >> > Write-Host ("`t Needed: $neededCount") -foregroundColor Yellow > >> > -backgroundColor black > >> > } else { > >> > "`t Needed: $neededCount" > >> > } > >> > > >> > if ($summary.FailedCount -gt 0) > >> > { > >> > Write-Host ("`t Failed: " + $summary.FailedCount) -foregroundColor Red > >> > -backgroundColor black > >> > } else { > >> > "`t Failed: " + $summary.FailedCount > >> > } > >> > > >> > "`t Unknown: " + $summary.UnknownCount > >> > "`t ------------------------------------------" > >> > } > >> > } > >> > "--------------------------------------------------" > >> > } > >> > > >> > >> This looks like PowerShell, not VBScript. > >> > >> -- > >> urkec > > > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
"WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message news:4ED8B4A7-DE80-4800-9CC7-4A81947ADD5C@microsoft.com... > > Al Thanks for your response. > > I installed the Powershell and renamed it to file.ps > I go to DOS prompt and type powershell and enter > > It changes the prompt to > > PS C:\> and then I type the file.ps and enter > and get this error ... > > The term 'file.ps' is not recognized as a cmdlet, function, operable > program, or script file. Verify the term and try again. > At line:1 char:18 > + file.ps <<<< > > Advise Please. Best advice would be to read up on powershell and/or check out microsoft.public.windows.powershell. Or you could try this command: powershell file.ps When you start powershell without a parameter, it expects you to type powershell commands interactively. /Al > > > > > > > > "Al Dunbar" wrote: > >> You will need to install powershell if it is not already installed. Then >> you >> will need to rename the file containing the script from whatever.vbs to >> whatever.ps. And if that does not do the trick, then I'd suggest you >> refer >> back to the introductory material found at the Script Centre. >> >> /Al >> >> "WILDPACKET" <WILDPACKET@discussions.microsoft.com> wrote in message >> news:905534C9-F422-47B7-9CDE-199E71507474@microsoft.com... >> > >> > Thank you urkec for your response. >> > How do I excute this script? >> > >> > >> > >> > "urkec" wrote: >> > >> >> "WILDPACKET" wrote: >> >> >> >> > >> >> > I found this on WSUS Site under Script Centre this >> >> > Provides a status report for approved updates. Every update approved >> >> > on >> >> > your >> >> > server is shown, with a list of the target groups for which it was >> >> > approved. >> >> > Within each group, counts are shown for how many computers have a >> >> > specific >> >> > status for that update: Installed, Needed, Failed, or Unknown. >> >> > >> >> > >> >> > >> >> > When I run this on the WSUS Server it gives me an error >> >> > >> >> > line 1 >> >> > character: 87. >> >> > Error: invalid character >> >> > code: 800A0408 >> >> > Source: Microsoft VBScript Compiling error >> >> > >> >> > >> >> > I am not the scripting guy. >> >> > >> >> > Anybody can advise Please. >> >> > >> >> > Thank you >> >> > >> >> > >> >> > >> >> > >> >> > >> >> > [reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Ad ministration") >> >> > | out-null >> >> > if (!$wsus) { >> >> > $wsus = >> >> > [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer(); >> >> > } >> >> > >> >> > "Server name: " +$wsus.Name; >> >> > "Using secure connection: " + $wsus.IsConnectionSecureForRemoting; >> >> > "Port number: " + $wsus.PortNumber; >> >> > >> >> > $updateScope = new-object >> >> > Microsoft.UpdateServices.Administration.UpdateScop e; >> >> > $updateScope.UpdateApprovalActions = >> >> > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Install >> >> > ` >> >> > -bor >> >> > [Microsoft.UpdateServices.Administration.UpdateAppr ovalActions]::Uninstall >> >> > >> >> > $wsus.GetUpdates($updateScope) | foreach { >> >> > $update = $_ #$_ is a shorthand variable for the current item in a >> >> > loop >> >> > >> >> > "--------------------------------------------------" >> >> > "Update: " + $update.Title >> >> > "Update Id: " + $update.Id.UpdateId >> >> > "--------------------------------------------------" >> >> > >> >> > $wsus.GetComputerTargetGroups() | foreach { >> >> > $group = $_ >> >> > if ($update.GetUpdateApprovals($group).Count -ne 0) >> >> > { >> >> > #`t is equivalent to \t in C#/C++ >> >> > "`t Computer Group: " + $group.Name >> >> > "`t ComputerTargetGroupId: " + $group.Id >> >> > "`t Approval action: " + >> >> > $update.GetUpdateApprovals($group)[0].Action >> >> > >> >> > $summary = $update.GetSummaryForComputerTargetGroup($group) >> >> > >> >> > "`t Installed:" + ($Summary.InstalledCount + >> >> > $summary.NotApplicableCount) >> >> > >> >> > $neededCount = ($summary.InstalledPendingRebootCount + >> >> > $summary.NotInstalledCount) >> >> > if ($neededCount -gt 0) >> >> > { >> >> > Write-Host ("`t Needed: $neededCount") -foregroundColor Yellow >> >> > -backgroundColor black >> >> > } else { >> >> > "`t Needed: $neededCount" >> >> > } >> >> > >> >> > if ($summary.FailedCount -gt 0) >> >> > { >> >> > Write-Host ("`t Failed: " + $summary.FailedCount) -foregroundColor >> >> > Red >> >> > -backgroundColor black >> >> > } else { >> >> > "`t Failed: " + $summary.FailedCount >> >> > } >> >> > >> >> > "`t Unknown: " + $summary.UnknownCount >> >> > "`t ------------------------------------------" >> >> > } >> >> > } >> >> > "--------------------------------------------------" >> >> > } >> >> > >> >> >> >> This looks like PowerShell, not VBScript. >> >> >> >> -- >> >> urkec >> >> >> |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Hello WILDPACKET,
> Al Thanks for your response. > > I installed the Powershell and renamed it to file.ps I go to DOS > prompt and type powershell and enter > > It changes the prompt to > > PS C:\> and then I type the file.ps and enter > and get this error ... > The term 'file.ps' is not recognized as a cmdlet, function, operable > program, or script file. Verify the term and try again. > At line:1 char:18 > + file.ps <<<< > > Advise Please. You need the extension to be .ps1 with the numeral 1 at the end. Then, in powershell, if file.ps1 is in your current directory: ..\file.ps1 You will probaly be told to change your execution policy. Read the suggested, and set the execution policy as desired Karl |
|
![]() |
| Outils de la discussion | |
|
|