0
私は、(64ビットコンピュータ)をダブルクリックしてpowershellスクリプトと同じ場所に.txtファイルに出力して、情報を生成するためのpowershellスクリプトを作成する必要があります。powershellコンピュータ情報スクリプト
- コンピュータ名/モデル/シリアル番号。コンピュータが実行されているバージョンのオペレーティングシステムCドライブ
- 上/使用可能なディスク領域
- Cドライブのサイズ、現在コンピュータにログオンしている
これまでのところ(しかし、それはかなり働いていません)私が持っている:あなたのスクリプトが起動され、あなたがOut-File "$PSScriptRoot\system-info.txt"
のような保存パスでそれを指定した場合、それが保存されます
$computerSystem = get-wmiobject Win32_ComputerSystem
$computerOS = get-wmiobject Win32_OperatingSystem
$computerHDD = Get-WmiObject Win32_LogicalDisk -Filter drivetype=3
$txtObject = New-Object PSObject -property @{
'PCName' = $computerSystem.Name
'Model' = $computerSystem.Model
'SerialNumber' = $computerBIOS.SerialNumber
'HDDSize' = "{0:N2}" -f ($computerHDD.Size/1GB)
'HDDFree' = "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size)
'OS' = $computerOS.caption
'SP' = $computerOS.ServicePackMajorVersion
'User' = $computerSystem.UserName
}
$txtObject | Select PCName, Model, SerialNumber, HDDSize, HDDFree, OS, SP, User | Get-Process | Out-File 'system-info.txt' -NoTypeInformation -Append