0
메신저 trayng는 서버에 대한 정보 메일을 보내려면이 스크립트를 실행하지만 난이 오류를 얻을 : GET 오류 WMI의 파워 쉘의 op_Division : 문자열
Method invocation failed because [System.Object[]] does not contain a method named 'op_Division'.
At C:\Users\admin-ran\Desktop\Startup-SendMailTEST.ps1:22 char:1
+ $compinfo = New-Object PSObject -property @{
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (op_Division:String) [], RuntimeException
+ FullyQualifiedErrorId : MethodNotFound
$compinfo = @()
$computerSystem = get-wmiobject Win32_ComputerSystem
$computerBIOS = get-wmiobject Win32_BIOS
$computerOS = get-wmiobject Win32_OperatingSystem
$computerCPU = get-wmiobject Win32_Processor
$computerHDD = Get-WmiObject Win32_LogicalDisk -Filter drivetype=3
$colItems = Get-WmiObject Win32_NetworkAdapterConfiguration -Filter "IpEnabled = TRUE"
# Build objects
$compinfo = New-Object PSObject -property @{
'PCName' = $computerSystem.Name
'Manufacturer' = $computerSystem.Manufacturer
'Model' = $computerSystem.Model
'SerialNumber' = $computerBIOS.SerialNumber
'RAM' = "{0:N2}" -f ($computerSystem.TotalPhysicalMemory/1GB)
'HDDSize' = "{0:N2}" -f ($computerHDD.Size/1GB)
'HDDFree' = "{0:P2}" -f ($computerHDD.FreeSpace/$computerHDD.Size)
'CPU' = $computerCPU.Name
'OS' = $computerOS.caption
'SP' = $computerOS.ServicePackMajorVersion
'User' = $computerSystem.UserName
'BootTime' = $computerOS.ConvertToDateTime($computerOS.LastBootUpTime)
'IP_Address' = [string]$colItems.IpAddress
'MAC_Address' = [string]$colItems.MacAddress
'Default_Gateway' = [string]$colItems.DefaultIpGateway
'DNS_Domain' = $colItems.DNSDomain
'DHCP_Enabled' = $colItems.DHCPEnabled
}
$compinfo | select -Property HDDFree ,HDDSize ,Ram ,OS ,CPU ,SP ,IP_Address,Mac_Address ,BootTime ,DHCP_Enabled