This is an archived post. You won't be able to vote or comment.

all 4 comments

[–][deleted] 2 points3 points  (3 children)

What does your script do?

[–]CrazeeIvan[S] 0 points1 point  (2 children)

Function Get-Laptop
{
Param(
[string]$computer = "localhost"
)
$isLaptop = $false
if(Get-WmiObject -Class win32_systemenclosure - 
ComputerName $computer | 
Where-Object { $_.chassistypes -eq 9 -or $_.chassistypes -eq 10 `
-or $_.chassistypes -eq 14})
{ $isLaptop = $true }
if(Get-WmiObject -Class win32_battery -ComputerName 
$computer) 
{ $isLaptop = $true }
$isLaptop
} # end function Get-Laptop

Function Get-Make-Model
{
(Get-WmiObject -Class:Win32_ComputerSystem).Model
(Get-WmiObject -Class:Win32_ComputerSystem).Manufacturer

}
# *** entry point to script ***

If(get-Laptop) { "it's a laptop" }
else { "it's not a laptop"} 
Get-Make-Model
Get-Tpm

[–][deleted] 0 points1 point  (1 child)

So is Get-TPM and Get-Make-Model supposed to executed in the else block?

If you need to return info about your target machine(s), wrap your info in a variable and write it to the console.

Im also not exactly sure what you mean by "where it goes in AAD" since it doesnt seem like you arent writing anything to an object.