Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $Path = "C:\TempPath\intelamt\results"
- If (Test-path("$Path\Summary.csv")) {
- }
- Else {
- New-Item -ItemType "file" -Path "$Path\Summary.csv"
- }
- $Computers = (get-childitem $Path -dir).fullname
- ForEach ($Computer in $Computers) {
- $Files = (get-childitem $Computer)
- ForEach ($File in $Files) {
- If ($File.name -like "*.xml") {
- $Vulnerable = Select-String -Path $File -SimpleMatch "<System_Risk>"
- }
- If ($File.name -eq "log.txt") {
- $Matches = @("talk to LMS","Error when talking to LMS","Failed to unprovision","Failed to get General AMT Settings","AMT reports Unauthorized")
- ForEach ($Match in $Matches) {
- $Unprovisioned = (Select-String -Path $File -SimpleMatch $Match)
- If ($Unprovisioned){
- break
- }
- }
- }
- If ($File.name -eq "scdisabled.txt") {
- $LMSDisabled = Select-String -Path $File -SimpleMatch "[SC] ChangeServiceConfig SUCCESS"
- $LMSInstalled = Select-String -Path $File -SimpleMatch "The specified service does not exist as an installed service"
- }
- }
- If ($Vulnerable) {
- $IsVulnerable = $Vulnerable.line -replace'[,]',''
- }
- If ($Unprovisioned) {
- $IsUnprovisioned = "Failed to unprovision"
- }
- Else {
- $IsUnprovisioned = "unprovisioned"
- }
- If ($LMSDisabled) {
- $IsLMSDisabled = "LMS service is disabled"
- }
- Else {
- $IsLMSDisabled = "Failed to disable LMS service"
- }
- If ($LMSInstalled) {
- $IsLMSInstalled = "LMS service not installed"
- }
- Else {
- $IsLMSInstalled = "LMS service is installed"
- }
- $HostName =(Get-Item $Computer).Name
- $PCSummary = "$HostName,$IsVulnerable,$IsUnprovisioned,$IsLMSDisabled,$IsLMSInstalled"
- Add-Content "$Path\Summary.csv" $PCSummary
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement