現在、いくつかの管理レポート用にPowershell Web サーバー PoSH ( http://poshserver.net/ ) を試しています。しかし、出力をフォーマットする方法がわかりません。
最初から:管理者権限で、デフォルトのショートカットでコンソールを起動します。Import-Module PoSHServer
次に、と入力しStart-PoSHServer
ます。Web サーバーが起動したら、本体セクションに $(command) という 1 行のコードを含む単純な index.ps1 ファイルを作成します。
たとえば、Get-Service Mpssvc
コマンドを使用したいのですが、得られるものは次のとおりです。
System.ServiceProcess.ServiceController
私は試してみGet-Service MpsSvc | Select Name,Status
ます。出力:
@{Name=MpsSvc; Status=Running}
コマンドレットについても同じことですGet-Process
。プロセスのリストを含む出力がありますが、次のように表示されます: System.Diagnostics.Process (AcroRd32)
...
ただし、(Posh デモンストレーション Web ページで使用されている) のような一部の cmlet はGet-Date
正常に動作し、「通常の」出力が得られます。
ドキュメントを読みましたが、そのために役立つ例はありません。
「クリーン」でコンソールのような出力を取得するために、powershell コードをどのように記述できますか?