サンプルスクリプトの実行
- List Basic Computer Information
- http://www.microsoft.com/technet/scriptcenter/scripts/msh/hardware/basic/hwbams01.mspx
を試しに実行してみた。
ページに記述されているスクリプトを ListBasicComputerInformation.ps1 というファイルに貼り付けて Windows PowerShell のコンソールから実行してみる。
PS C:\> .\ListBasicComputerInformation.ps1
File C:\ListBasicComputerInformation.ps1 cannot be loaded because the execution
of scripts is disabled on this system. Please see "get-help about_signing" for
more details.
At line:1 char:34
+ .\ListBasicComputerInformation.ps1 <<<<
PS C:\>
セキュリティポリシーに引っかかってしまった(^^;
PS C:\> Get-ExecutionPolicy
Restricted
PS C:\> Set-ExecutionPolicy RemoteSigned
PS C:\>
でセキュリティポリシーをローカルのスクリプトファイルは署名無しで実行出来るように変更。
PS C:\> .\ListBasicComputerInformation.ps1
Administrator Password Status: 3
Automatic Reset Boot Option: True
Automatic Reset Capability: True
Boot Option On Limit:
Boot Option On WatchDog:
Boot ROM Supported: True
Bootup State: Normal boot
(略)
WakeUp Type: 7
Workgroup:
PS C:\>
ということで、PC の基本情報を取得することが出来た。