Wie kriege ich ein Powershell script zum laufen ?
Please also mark the comments that contributed to the solution of the article
Content-Key: 153874
Url: https://administrator.de/contentid/153874
Printed on: April 26, 2024 at 04:04 o'clock
10 Comments
Latest comment
hier zum testen:
# **************************************************************
# * Dieser PowerShell Batch- File dient zum Erstellen einer HTML-Seite *
# * Als Inhalt alle Dienste auf dem Lokalen Computer *
# * *
# **************************************************************
# Das muß einmal auf der powershell ausgeführt werden
# "Set-ExecutionPolicy Unrestricted"
# **************************************************************
# **************************************************************
$a = Get-Service | Sort-Object Status -Descending
$a | ConvertTo-Html -Property Name,Status -body "Alle Dienste auf diesem Rechner" -title "GetService Liste" | ForEach-Object { if ($_ -like "*<td>Running</td>*") {$_ -replace "<tr>", "<tr bgcolor=green>"} elseif ($_ -like "*<td>Stopped</td>*"){$_ -replace "<tr>", "<tr bgcolor=red>"} else {$_ -replace "<tr>", "<tr bgcolor=blue>"}} > c:\A10.html
invoke-item c:\a10.html
Geht mich ja nichts an, aber...
Würde es helfen, wenn er zusätzlich noch das Wort "Unrestricted" mit so vielen Buchstaben schreibt wie micneu?
Er hat ja abgefeuert:
PS C:\users\tka\desktop> Set-ExecutionPolicy Unrestriced
Und das wurde doch auch angemeckert.
Oder wie übersetzt ihr InvalidArgument:
Grüße
Biber
Würde es helfen, wenn er zusätzlich noch das Wort "Unrestricted" mit so vielen Buchstaben schreibt wie micneu?
Er hat ja abgefeuert:
PS C:\users\tka\desktop> Set-ExecutionPolicy Unrestriced
Und das wurde doch auch angemeckert.
Oder wie übersetzt ihr InvalidArgument:
+ Set-ExecutionPolicy <<<< Unrestriced .\scriptname.ps1
+ CategoryInfo : InvalidArgument: [Set-ExecutionPolicy], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
Grüße
Biber