Split-Path -Path (($myInvocation.MyCommand.Definition)


I’m running into an issue whereby an Error log I’m creating while running is being filled with an error that is created within the write-log function in AppDeployToolkitMain.ps1. It occurs on machines that are running Powershell v2, I get:
Split-Path : Cannot find drive. A drive with the name '& { . ‘C’ does not exist

which floods the error logs. Anyone got an easy fix for this? Here’s the line that causes the issue:

[string]$ScriptSource = Split-Path -Path $myInvocation.MyCommand.Definition -Leaf -ErrorAction ‘Stop’

I can work around it, I just wondered if this has been seen before/already tackled?



Never saw that error. Insert a breakpoint into your script then run manually those command. Probably, you will recreate those error.