Advertisement
FSCorrupted

SCCM Upgrade Preflight OneLiner

Oct 18th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #Get Battery
  2. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; if ((Get-WmiObject win32_Battery).BatteryStatus -eq '2'){$IsAC='TRUE'}; $tsenv.Value('IsAC') = $IsAC }"
  3.  
  4. #Get Model
  5. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; if ((Get-WmiObject win32_ComputerSystem).Manufacturer -eq 'Lenovo'){$Model=(Get-WmiObject win32_ComputerSystemProduct).Version} Else {$Model=(Get-WmiObject win32_ComputerSystem).Model}; $tsenv.Value('Model') = $Model }"
  6.  
  7. #Get UEFI
  8. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; if ((Get-WmiObject Win32_DiskPartition).type -eq 'GPT: System'){$IsUEFI='TRUE'}; $tsenv.Value('IsUEFI') = $IsUEFI }"
  9.  
  10. #Get Version
  11. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; if ((Get-WmiObject Win32_OperatingSystem).Version -eq '10.0.17134'){$OSVer='FALSE'} Else {$OSVer = 'TRUE'}; $tsenv.Value('OSVer') = $OSVer }"
  12.  
  13. #Get Total RAM
  14. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; ; if ((Get-wmiobject Win32_PhysicalMemory | Measure-Object -Property capacity -Sum).sum/1gb -ge '2'){$TotalRam='TRUE'}; $tsenv.Value('TotalRam') = $TotalRam }"
  15.  
  16. #Get Free Diskspace
  17. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; if ((Get-PSDrive C).free/1gb -ge '30'){$FreeSpace='TRUE'};$tsenv.Value('FreeSpace') = $FreeSpace }"
  18.  
  19. #Get LAN
  20. powershell.exe -executionpolicy bypass -command "& {$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment; $NetAdapter= Get-NetAdapter |Where-Object {$_.PhysicalMediaType -eq '802.3'}; If ($NetAdapter.Status -eq 'Up') {$IsLan='TRUE'};$tsenv.Value('IsLan') = $IsLan }"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement