The term 'adtSession.DirFiles' is not recognized

I am getting the error “the term ‘adtSession.DirFiles’ is not recognized as the name of a cmdlet, script file or operable program.”

Here is the code I am trying to run: Start-ADTProcessAsUser -FilePath “$(adtSession.DirFiles)\NukeOneDriveProcessAccount.ps1 -ArgumentList ExecutionPolicy -Bypass”

I am not sure why it is throwing this error. I copied the code from the Start-ADTProcessAsUser example: Start-ADTProcessAsUser -FilePath “$($adtSession.DirFiles)\setup.exe” -ArgumentList ‘/S’ -SuccessExitCodes 0, 500

I haven’t had a lot of exposure to PSADT or powershell until recently so I am sure I am missing something. From what I can tell there is a line in the PSAppDeployToolkit.psm1 calling out $adtSession.DirFile
{
$adtSession.DirFiles = “$Path\Files”
$adtSession.DirSupportFiles = “$Path\SupportFiles”
}
So I am not sure why I am getting the error. I would appreciate any help.

You’re missing the dollar sign at the start of adtSession.DirFiles. It needs to be $($adtSession.DirFiles), not $(adtSession.DirFiles).

3 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.