tcox8 / OSD-Reporting

This script creates a webpage to show SCCM OSD Reporting
16 stars 5 forks source link

Blank webpage #6

Closed perfectly-preserved-pie closed 3 years ago

perfectly-preserved-pie commented 3 years ago

I followed the detailed guide.

Here is my Task Scheduler parameters: -NoProfile -ExecutionPolicy Bypass -File "E:\Sources\OSD\Scripts\OSDReporting.ps1" -SQLServer "uswc01.ad.com" -Database "CM_WCE" -TSAdvertisementID "WCE2003E" -TaskSequenceID "WCE001E7" -IISPath "C:\inetpub\OSD"

USCWC01.ad.com is the actual hostname of the server; however I have a CNAME that redirects osd.sccm.uswc01.ad.com to USWC01.ad.com. I would like to use osd.sccm.uswc01.ad.com for this webpage.

Browsing to osd.sccm.uswc01.ad.com:80 results in a blank page in Firefox and Edge. However, the custom favicon displays in the tab (the little home icon). Any ideas why this page isn't populating?

If I manually run the PS1 script and type in the parameters, I get these errors:

Cannot index into a null array.
At E:\Sources\OSD\Scripts\OSDReporting.ps1:271 char:1
+ $DriverIndexStart = $TSDriverSteps[0].name #Get the name of the first ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Compare-Object : Cannot bind argument to parameter 'DifferenceObject' because it is null.
At E:\Sources\OSD\Scripts\OSDReporting.ps1:273 char:85
+ ... nceObject $TSSteps.Name -DifferenceObject $TSDriverSteps.Name -PassTh ...
+                                               ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Compare-Object], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Microsoft.PowerShell.Commands.CompareObjectCommand

Cannot index into a null array.
At E:\Sources\OSD\Scripts\OSDReporting.ps1:277 char:1
+ $TSStepsNoDrivers = $TSStepsNoDrivers[0..($index -1)] + "Install Driv ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray
tcox8 commented 3 years ago

@shift-faced The webpage will be blank if there have been no Task Sequence steps executed. i.e. Has someone imaged a computer yet?

Verify your TaskSequenceID and run line 269 manually. Does it retrieve the steps from the Task Sequence?

perfectly-preserved-pie commented 3 years ago

@shift-faced The webpage will be blank if there have been no Task Sequence steps executed. i.e. Has someone imaged a computer yet?

That's good to know. There wasn't anyone imaging, but there is now and it's still blank.

Verify your TaskSequenceID and run line 269 manually. Does it retrieve the steps from the Task Sequence?

Yes, it retrieves all the steps from the correct task sequence. I'm guessing that TaskSequenceID is the same as the PackageID? If so, then I have it set correctly.

tcox8 commented 3 years ago

You are correct, the TaskSequenceID is the PackageID. When you manually run the script, does it still give you errors (now that someone has imaged)?

After you run it is the $Messages variable empty? i.e. "Write-Host $Messages"

tcox8 commented 3 years ago

@shift-faced Also, can you send a screenshot of your task sequence steps from the sccm console?

perfectly-preserved-pie commented 3 years ago

You are correct, the TaskSequenceID is the PackageID. When you manually run the script, does it still give you errors (now that someone has imaged)?

Yep, still the same errors.

After you run it is the $Messages variable empty? i.e. "Write-Host $Messages"

$Messages does return output.

Here's a screenshot of my TS... had to redact some stuff but hopefully you get what you need. tasksequence

tcox8 commented 3 years ago

I'll try to dig in this deeper but off the top of my head my guess would be that the Get-CMTaskSequenceStepApplyDriverPackage does not work with "Modern Driver Management." Can you manually run line 270 and see if you are getting any steps listed for the $TSDriverSteps variable?

perfectly-preserved-pie commented 3 years ago

Ahh you're on to something I think. Manually running line 270 does not return any output or steps for the $TSDriverSteps variable.

Is there a workaround? Can I just comment out the lines mentioning the drivers? Lines 270-277?

tcox8 commented 3 years ago

I've added some logic to workaround (hopefully) the MDM. Use the code in branch "Ver2.3" and add "-MDM $True" to your parameters. Report back on the results.

Link to Ver 2.3 branch

perfectly-preserved-pie commented 3 years ago

No dice; I'm still getting a blank gray page. When I execute the script from the 2.3 branch manually, I no longer receive any errors (or any output at all).

tcox8 commented 3 years ago

Questions: Did you add the MDM parameter and set it to true when manually running it?

Are the steps retrieved? By that I mean, can you check to see that both $TSStepsNoDrivers and $TSSteps contain the same data, i.e. the TS steps? I'm looking at line 285, for reference. Can you send me a screenshot of the output?

Verify computers have been imaging, i.e. does the $Messages variable contain data? Can you send me a screenshot of the output?

perfectly-preserved-pie commented 3 years ago

Questions: Did you add the MDM parameter and set it to true when manually running it?

Yes I did.

Are the steps retrieved? By that I mean, can you check to see that both $TSStepsNoDrivers and $TSSteps contain the same data, i.e. the TS steps? I'm looking at line 285, for reference. Can you send me a screenshot of the output?

Yep, both variables contain the same data (TS steps):

tssteps

Verify computers have been imaging, i.e. does the $Messages variable contain data? Can you send me a screenshot of the output?

$Messages doesn't return any output even though I have one VM being imaged right now.

tcox8 commented 3 years ago

Does $SMSMSGSLocation contain data? (Lines 67-74).

And can you verify that the 3 files exist in that location "svrmsgs.dll", "provmsgs.dll", and "climsgs.dll"

perfectly-preserved-pie commented 3 years ago

Yup:


PS MDR:\> $SMSMSGSLocation
C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\00000409

PS MDR:\> cd $SMSMSGSLocation

PS C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\00000409> ls

    Directory: C:\Program Files (x86)\Microsoft Configuration Manager\AdminConsole\bin\i386\00000409

Mode                LastWriteTime         Length Name                                                                                                                                                                                                            
----                -------------         ------ ----                                                                                                                                                                                                            
-a----        3/10/2021   9:42 AM          73080 baserc.dll                                                                                                                                                                                                      
-a----        3/10/2021   9:42 AM         208248 climsgs.dll                                                                                                                                                                                                     
-a----        3/10/2021   9:42 AM          44408 CmRcViewerRes.dll                                                                                                                                                                                               
-a----        3/10/2021   9:42 AM          46440 compmgrres.dll                                                                                                                                                                                                  
-a----        3/10/2021   9:42 AM         148344 provmsgs.dll                                                                                                                                                                                                    
-a----        3/10/2021   9:42 AM         968552 srvmsgs.dll                                                                                                                                                                                                     
-a----        3/10/2021   9:42 AM         146296 _statvw.dll                                                                                                                                                                                                     
tcox8 commented 3 years ago

We'll start higher and work down to more granular. $StatusMessages variable have any data?

If not, we are not receiving data from the database. That could mean the other variables are off (did the advertisement ID change?) or connection issues to the database. Double check the parameters.

perfectly-preserved-pie commented 3 years ago

Ok, it might have something to do with the TS Advertisement ID. I have my TS deployed to 3 different collections:

ts

FYI, "OSD" is a collection that contains both "All Windows Workstations" and "All Unknown Computers".

Which one should I be using for this script?

tcox8 commented 3 years ago

You would use whichever advertisement ID you are wanting to monitor. If OSD contains both of the other two you should be able to just use that advertisement ID. Is that what you were using?

perfectly-preserved-pie commented 3 years ago

Yeah, I was using the OSD collection (SMS20040). $StatusMessages didn't return any output.

tcox8 commented 3 years ago

Try one-at-a-time swapping out with the other two and check the results. I can work on some logic to handle passing multiple advertisement IDs to give results of different deployments.

tcox8 commented 3 years ago

I've created version 2.4 and have introduced the ability to process multilple TSAdvertisementIDs and logic to display on the webpage if there is an issue pulling data/running the query or if no devices were found to be imaging.

Link to Ver 2.4 branch

tcox8 commented 3 years ago

@shift-faced What's the status?

tcox8 commented 3 years ago

Closing issue due to no response