codaamok / PoSH

A collection of PowerShell scripts I've written.
MIT License
24 stars 6 forks source link

You cannot call a method on a null-valued expression #7

Closed kmccb closed 4 years ago

kmccb commented 4 years ago

Having issues, hoping you can help.. One confusing note, your documentation makes it seem like all you have to do is run the CM-2002.ps1 and everything is done automatically (after installing AL and copying your files to the folder)..

However, I had to create a switch named Internet for it to get past one error.. Now it's getting the below:

https://pastebin.com/vL8kFSsM

Thanks

codaamok commented 4 years ago

Hi, please make sure you are using the latest files available either from my repo. Let me know the outcome after you've done this. Cheers

kmccb commented 4 years ago

Done.. Please see below.. Getting further but still failing. Both VMs were built but CM01 doesnt have ConfigMgr installed.

https://pastebin.com/Ftsx03py

codaamok commented 4 years ago

Hey, I made a change. Please redownload again

kmccb commented 4 years ago

Next error.. I tried running it 3 times and it stopped on same spot every time.

https://pastebin.com/Kvn2K3Wz

codaamok commented 4 years ago

I really need to implement some sort of version identifier in the standard output stream.

I'm not 100% convinced you're running the latest CM-2002.ps1. I think you're only updating the script files in the LabSouces\CustomRoles\CM2002 folder. I'm seeing some output in your pastebin which was adjusted in CM-2002.ps1 some time ago. I guess the only way to be sure right now is to generate a hash for each file:

PS C:\> Get-FileHash .\CM-2002.ps1

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          D262471A9C077E3E35D5A5174D15DB12BD835F0E62435BDEC6FF51D0253AA733       C:\git\PoSH\AutomatedLab\CM-2002.ps1

PS C:\> Get-FileHash .\CustomRoles\CM-2002\*

Algorithm       Hash                                                                   Path
---------       ----                                                                   ----
SHA256          8651E809FBE90FE75DCF32F148C8D3E7C8CD77E7384A65A589AA1F25356DB9FE       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\ConfigurationFile-SQL.ini
SHA256          EE62AFCFB17018C9E61D731A781374D1D45F43179988AC51101074752E2FAF77       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\HostStart.ps1
SHA256          1A500BE9E8A5E0344C6EFD4FEC486BFC5F27418BA13F2018CA00CEC194F034DD       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\Invoke-CustomiseCM.ps1
SHA256          6AFB9A0AD8BE06CD22E0E7B8CC83FB61EEB02CABBB2E4797A92A8AEE42437D3D       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\Invoke-DownloadADK.ps1
SHA256          6D6C5030EAD04BBDDDBC99EDE5AEB5DC7F119CD0B3E9BB67E6B604DCEE0163D1       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\Invoke-DownloadCM.ps1
SHA256          5B2EA7EF8E3BE7C2B133A79AB9EF7B3CA597420605AF43673C36D81534FBCD41       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\Invoke-DownloadMisc.ps1
SHA256          65783A53CA85E299345D54553AAAE6E097A09E496D70EA077812DD00E3F48046       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\Invoke-InstallCM.ps1
SHA256          006EA20513688A400E13ED4AE670F2837B18C1396115F2CB4333C56C4FE7CB7B       C:\git\PoSH\AutomatedLab\CustomRoles\CM-2002\Invoke-UpdateCM.ps1

By the way, I notice you're calling CM-2002.ps1 within the CustomRoles directory - this is OK. I figured I would mention that in case you thought it was an issue from looking at the above.

Also, I notice you're not disposing of the lab each time you're trying. When you're retrying like this after experiencing an error, make sure you delete the lab in between attempts using Remove-Lab -Name "CMLab01" (or whatever lab name you set with the -LabName parameter - you can list all your current AutomatedLab labs with Get-Lab -List).

kmccb commented 4 years ago

https://pastebin.com/VeRpw7DY

codaamok commented 4 years ago

OK, looks better now you've updated the files.

The next hurdle is this error There was a problem downloading your product thrown when attempting to install WinPE.

  1. Inside the VM, do you see directory C:\Install\WinPE with items in it? It should be roughly 2.8GB with 17 files.
  2. On your host, do you see anything inside E:\LabSources\SoftwarePackages\WinPE? The size and number of files should match,
  3. If yes to both 1 and 2, go to the VM CM01 and go to folder C:\Install\WinPE. Double click adkwinpesetup.exe and try to complete installation manually. Hopefully the GUI gives you more information other than just There was a problem downloading your product.
kmccb commented 4 years ago

No VMs have C:\Install\WinPE

Under E:\LabSources\SoftwarePackages\WinPE that folder is only 4mb..

kmccb commented 4 years ago

I got it.. My PC has two NICS.. The "Internet" nic wasn't even plugged in.. Changed it to use the one that was and it's working. Thanks