Dot Source AppDeployToolkitMain.ps1 throw an error

Topics: Archive - Deployment Scripts
Dec 15, 2014 at 4:06 PM
Hello, in my particuliar envoronnent the variable $env:USERDOMAIN is not set at the point of installing applications in my task sequence. I use the version 3.5.0 of the toolkit which is amazing but if it run into an error when it dot source the main script if it run into an error the script stop. Ex: a environnemnt variable that is not set.
My workaround is to check this particuliar variable and give it a value if it haven't. Thank you
Developer
Dec 15, 2014 at 4:48 PM
Can you share the error details from when you run into this problem?
Dec 15, 2014 at 5:15 PM
Module [C:\Windows\ccmcache\3e\AppDeployToolkit\AppDeployToolkitMain.ps1] failed to load:
Vous ne pouvez pas appeler de méthode sur une expression ayant la valeur Null.

Au niveau de C:\Windows\ccmcache\3e\AppDeployToolkit\AppDeployToolkitMain.ps1 : 116 Caractère : 49
  • [string]$envUserDomain = $env:USERDOMAIN.ToUpper <<<< ()
I able to get the error while just running the script on a other windows host that is in windows. Just by remove the USERDOMAIN environnement variable.
I am not saying that is an error in the main script, i think it the error handling.
I really appreciate!
Developer
Dec 15, 2014 at 9:08 PM
Changing the line to this will fix the problem. I will integrate this fix into next version of the toolkit:
[string]$envUserDomain = $env:USERDOMAIN | Where-Object { $_ } | ForEach-Object { $_.ToUpper() }
Marked as answer by meterien on 12/16/2014 at 12:01 PM
Dec 16, 2014 at 7:01 PM
mmashwani wrote:
Changing the line to this will fix the problem. I will integrate this fix into next version of the toolkit:
[string]$envUserDomain = $env:USERDOMAIN | Where-Object { $_ } | ForEach-Object { $_.ToUpper() }
Thanks!