Issues with custom function

Hello I added a custom function to the toolkit extensions. However I am having issues running it. Here is a copy of the log and script.

LOG_________________________________________________________________
]LOG]!><time=“11:35:23.119-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: The following users are logged on to the system: contoso\myusername]LOG]!><time=“11:35:23.125-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Current process is running under a user account [contoso\myusername]]LOG]!><time=“11:35:23.131-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: There is no console user logged in (user with control of physical monitor, keyboard, and mouse).]LOG]!><time=“11:35:23.136-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: The active logged on user is [contoso\myusername]]LOG]!><time=“11:35:23.140-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: The active logged on user [contoso\myusername] has a primary UI language of [EN].]LOG]!><time=“11:35:23.153-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: The active logged on user [contoso\myusername] has a DPI scale factor of [100] with DPI pixels [96].]LOG]!><time=“11:35:23.158-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: The process is running in a terminal server session: [True].]LOG]!><time=“11:35:23.166-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Unable to load COM Object [Microsoft.SMS.TSEnvironment]. Therefore, script is not currently running from a SCCM Task Sequence.]LOG]!><time=“11:35:23.176-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Skipping attempt to check for and make the task scheduler services healthy because the App Deployment Toolkit is not running under the [NT AUTHORITY\SYSTEM] account.]LOG]!><time=“11:35:23.180-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Session 0 not detected.]LOG]!><time=“11:35:23.184-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Installation is running in [Interactive] mode.]LOG]!><time=“11:35:23.188-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Deployment type is [Installation]]LOG]!><time=“11:35:23.193-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Initialization] :: Discovered Zero-Config MSI installation file [C:\Users\myusername\Desktop\ESSBASE\Files\ISScript10.Msi].]LOG]!><time=“11:35:23.197-240” date=“04-23-2015” component=“PSAppDeployToolkit” context=“contoso\myusername” type=“1” thread=“3140” file=“AppDeployToolkitMain.ps1”>
<![LOG[[Pre-Installation] :: Check for running application(s) [excel,IDriver]…]LOG]!><time=“11:35:23.226-240” date=“04-23-2015” component=“Get-RunningProcesses” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Application(s) are not running.]LOG]!><time=“11:35:23.238-240” date=“04-23-2015” component=“Get-RunningProcesses” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Finished checking running application(s).]LOG]!><time=“11:35:23.244-240” date=“04-23-2015” component=“Get-RunningProcesses” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: [-BlockExecution] parameter specified.]LOG]!><time=“11:35:23.253-240” date=“04-23-2015” component=“Show-InstallationWelcome” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Create scheduled task to cleanup blocked applications in case installation is interrupted.]LOG]!><time=“11:35:23.277-240” date=“04-23-2015” component=“Block-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Retrieve Scheduled Tasks]LOG]!><time=“11:35:23.287-240” date=“04-23-2015” component=“Get-ScheduledTask” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Scheduled task [InstallShieldSoftwareCorp._ISScript_3.00.185_EN_01_BlockedApps] already exists.]LOG]!><time=“11:35:27.566-240” date=“04-23-2015” component=“Block-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Set the Image File Execution Option registry key to block execution of [excel.exe].]LOG]!><time=“11:35:27.571-240” date=“04-23-2015” component=“Block-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Return fully qualified registry key path [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\excel.exe]]LOG]!><time=“11:35:27.592-240” date=“04-23-2015” component=“Convert-RegistryPath” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Update registry key value: [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\excel.exe] [Debugger = wscript.exe “C:\Users\Public\PSAppDeployToolkit\AppDeployToolkit_BlockAppExecutionMessage.vbs”]]LOG]!><time=“11:35:27.599-240” date=“04-23-2015” component=“Set-RegistryKey” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Set the Image File Execution Option registry key to block execution of [IDriver.exe].]LOG]!><time=“11:35:27.639-240” date=“04-23-2015” component=“Block-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Return fully qualified registry key path [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\IDriver.exe]]LOG]!><time=“11:35:27.656-240” date=“04-23-2015” component=“Convert-RegistryPath” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Update registry key value: [Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\IDriver.exe] [Debugger = wscript.exe “C:\Users\Public\PSAppDeployToolkit\AppDeployToolkit_BlockAppExecutionMessage.vbs”]]LOG]!><time=“11:35:27.663-240” date=“04-23-2015” component=“Set-RegistryKey” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Display balloon tip notification with message [Installation started.]]LOG]!><time=“11:35:27.691-240” date=“04-23-2015” component=“Show-BalloonTip” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Spin up progress dialog in a separate thread with message: [EssBase 11.1.2.2 Installation in Progress.]]LOG]!><time=“11:35:27.826-240” date=“04-23-2015” component=“Show-InstallationProgress” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: [EssBaseRegDel.exe] successfully resolved to fully qualified path [C:\Users\myusername\Desktop\ESSBASE\Files\EssbaseRegDel.exe].]LOG]!><time=“11:35:29.616-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Working Directory is [C:\Users\myusername\Desktop\ESSBASE\Files]]LOG]!><time=“11:35:29.638-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Executing [C:\Users\myusername\Desktop\ESSBASE\Files\EssbaseRegDel.exe]…]LOG]!><time=“11:35:29.647-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Execution completed with exit code [0]]LOG]!><time=“11:35:30.405-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Error Record:

Message : Property ‘Value’ cannot be found on this object. Make sure tha
t it exists.
InnerException :

FullyQualifiedErrorId : PropertyNotFoundStrict

PositionMessage :
At C:\Users\myusername\Desktop\ESSBASE\AppDeployToolkit\AppDepl
oyToolkitMain.ps1:552 char:28
+ If ($script:MyInvocation. <<<< Value.ScriptName) {
[string]$ScriptSource = Split-Path -Path $script:MyInvocation
.Value.ScriptName -Leaf } Else { [string]$ScriptSource = Spli
t-Path -Path $script:MyInvocation.MyCommand.Definition -Leaf
}

]LOG]!><time=“11:35:31.094-240” date=“04-23-2015” component=“Deploy Application” context=“contoso\myusername” type=“3” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Display Dialog Box with message: Error Record:

Message : Property ‘Value’ cannot be found on this object. Make sure tha
t it exists.
InnerException :

FullyQualifiedErrorId : PropertyNotFoundStrict

PositionMessage :
At C:\Users\myusername\Desktop\ESSBASE\AppDeployToolkit\AppDepl
oyToolkitMain.ps1:552 char:28
+ If ($script:MyInvocation. <<<< Value.ScriptName) {
[string]$ScriptSource = Split-Path -Path $script:MyInvocation
.Value.ScriptName -Leaf } Else { [string]$ScriptSource = Spli
t-Path -Path $script:MyInvocation.MyCommand.Definition -Leaf
}

…]LOG]!><time=“11:35:31.114-240” date=“04-23-2015” component=“Show-DialogBox” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Dialog Box Response: OK]LOG]!><time=“11:36:49.591-240” date=“04-23-2015” component=“Show-DialogBox” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Close the installation progress dialog.]LOG]!><time=“11:36:49.616-240” date=“04-23-2015” component=“Close-InstallationProgress” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Remove the Image File Execution Options registry key to unblock execution of [excel.exe].]LOG]!><time=“11:36:49.721-240” date=“04-23-2015” component=“Unblock-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Remove the Image File Execution Options registry key to unblock execution of [IDriver.exe].]LOG]!><time=“11:36:49.734-240” date=“04-23-2015” component=“Unblock-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Retrieve Scheduled Tasks]LOG]!><time=“11:36:49.752-240” date=“04-23-2015” component=“Get-ScheduledTask” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Delete Scheduled Task [InstallShieldSoftwareCorp._ISScript_3.00.185_EN_01_BlockedApps].]LOG]!><time=“11:36:52.021-240” date=“04-23-2015” component=“Unblock-AppExecution” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: [C:\Windows\System32\schtasks.exe] is a valid fully qualified path, continue.]LOG]!><time=“11:36:52.033-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Working Directory is [C:\Windows\System32]]LOG]!><time=“11:36:52.041-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Executing [C:\Windows\System32\schtasks.exe /Delete /TN InstallShieldSoftwareCorp._ISScript_3.00.185_EN_01_BlockedApps /F]…]LOG]!><time=“11:36:52.046-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Execution completed successfully with exit code [0]]LOG]!><time=“11:36:52.154-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: InstallShieldSoftwareCorp._ISScript_3.00.185_EN_01 Installation completed with exit code [60001].]LOG]!><time=“11:36:52.163-240” date=“04-23-2015” component=“Exit-Script” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Display balloon tip notification asyhchronously with message [Installation failed.]]LOG]!><time=“11:36:52.175-240” date=“04-23-2015” component=“Show-BalloonTip” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe] is a valid fully qualified path, continue.]LOG]!><time=“11:36:52.192-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Working Directory is [C:\Windows\System32\WindowsPowerShell\v1.0]]LOG]!><time=“11:36:52.201-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: Executing [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe [PowerShell ScriptBlock]]…]LOG]!><time=“11:36:52.206-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: NoWait parameter specified. Continuing without waiting for exit code…]LOG]!><time=“11:36:52.212-240” date=“04-23-2015” component=“Execute-Process” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>
<![LOG[[Pre-Installation] :: -------------------------------------------------------------------------------]LOG]!><time=“11:36:52.220-240” date=“04-23-2015” component=“Exit-Script” context=“contoso\myusername” type=“1” thread=“3140” file=“Deploy-Application.ps1”>

END LOG______________________________

SCRIPT___________________________________

<#
.SYNOPSIS
This script is a template that allows you to extend the toolkit with your own custom functions.
.DESCRIPTION
The script is automatically dot-sourced by the AppDeployToolkitMain.ps1 script.
.NOTES
Toolkit Exit Code Ranges:
60000 - 68999: Reserved for built-in exit codes in Deploy-Application.ps1, Deploy-Application.exe, and AppDeployToolkitMain.ps1
69000 - 69999: Recommended for user customized exit codes in Deploy-Application.ps1
70000 - 79999: Recommended for user customized exit codes in AppDeployToolkitExtensions.ps1
.LINK
http://psappdeploytoolkit.codeplex.com
#>
[CmdletBinding()]
Param (
)

##===============================================
##
VARIABLE DECLARATION
##*===============================================

Variables: Script

[string]$appDeployToolkitExtName = ‘PSAppDeployToolkitExt’
[string]$appDeployExtScriptFriendlyName = ‘App Deploy Toolkit Extensions’
[version]$appDeployExtScriptVersion = [version]‘1.5.0’
[string]$appDeployExtScriptDate = ‘03/20/2015’
[hashtable]$appDeployExtScriptParameters = $PSBoundParameters

##===============================================
##
FUNCTION LISTINGS
##*===============================================

#region Function Remove-EnvirVariablePathValue
Function Remove-EnvirVariablePathValue
{

<#
.SYNOPSIS
Function to remove one or more folders from the Path environment variable.

.PARAMETER Folders
Specifies the folders to remove from the Path environment variable…

.PARAMETER EnvironmentVariableTarget
Specifies the “scope” to use for the Path environment variable (“Process”,
“Machine”, or “User”). Defaults to “Process” if the parameter is not specified.

.EXAMPLE
Remove-EnvirVariablePathValue -Folders ‘FolderName’ -EnvironmentVariableTarget ‘VariableScope’
#>

[CmdLetBinding()]
param (
	[parameter(Mandatory = $true, ValueFromPipeline = $true)]
	[string[]] $Folders,
	[string] $EnvironmentVariableTarget = "Machine")

begin {
	## Get the name of this function and write header
	[string]${CmdletName} = $PSCmdlet.MyInvocation.MyCommand.Name
	Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -CmdletBoundParameters $PSBoundParameters -Header

	Set-StrictMode -Version Latest
	$ErrorActionPreference = "Stop"
	
	Write-Log -Message "Path environment variable target: [$EnvironmentVariableTarget]" -Source ${CmdletName} -Severity 1
	
	[bool] $isInputFromPipeline =
	($PSBoundParameters.ContainsKey("Folders") -eq $false)
	
	[int] $foldersRemoved = 0
	
	[string[]] $pathFolders = [Environment]::GetEnvironmentVariable(
	"Path",
	$EnvironmentVariableTarget) -Split ";"
	
	[Collections.ArrayList] $folderList = New-Object Collections.ArrayList
	
	$pathFolders | foreach {
		$folderList.Add($_) | Out-Null
		
		
		
	}
}

process
{
	If ($isInputFromPipeline -eq $true)
	{
		$items = $_
	}
	Else
	{
		$items = $Folders
	}
	
	$items | foreach {
		[string] $folder = $_
		
		[bool] $isFolderInList = $false
		
		for ([int] $i = 0; $i -lt $folderList.Count; $i++)
		{
			If ([string]::Compare($folderList[$i], $folder, $true) -eq 0)
			{
				$isFolderInList = $true
				
				Write-Log -Message "Removing folder [$folder] from Path environment variable..." -Source ${CmdletName} -Severity 2
				
				$folderList.RemoveAt($i)
				$i--
				
				$foldersRemoved++
			}
		}
		
		If ($isFolderInList -eq $false)
		{
			Write-Log -Message "The folder [$folder] is not specified in the Path list." -Source ${CmdletName} -Severity 3
			
		}
	}
}

end
{
	If ($foldersRemoved -eq 0)
	{
		Write-Log -Message "No changes to the Path environment variable are necessary." -Source ${CmdletName} -Severity 1
		
		return
	}
	
	[string] $delimitedFolders = $folderList -Join ";"
	
	[Environment]::SetEnvironmentVariable(
	"Path",
	$delimitedFolders,
	$EnvironmentVariableTarget)
	
	Write-Log -Message "Successfully removed [$foldersRemoved] folder(s) from Path environment variable." -Source ${CmdletName} -Severity 2
	
	Write-FunctionHeaderOrFooter -CmdletName ${CmdletName} -Footer
}

}

#endregion

##===============================================
##
END FUNCTION LISTINGS
##*===============================================

##===============================================
##
SCRIPT BODY
##*===============================================

If (scriptParentPath) { Write-Log -Message "Script [(MyInvocation.MyCommand.Definition)] dot-source invoked by [(((Get-Variable -Name MyInvocation).Value).ScriptName)]" -Source appDeployToolkitExtName } Else { Write-Log -Message "Script [($MyInvocation.MyCommand.Definition)] invoked directly" -Source $appDeployToolkitExtName
}

##===============================================
##
END SCRIPT BODY
##*===============================================

I think I solved my own issue it was my strict mode setting.

Glad to hear the problem is solved. For future reference, please open the log file in CMTrace and copy/paste the text of the log file from there as the above raw log file is very difficult to read. Also, please post log files and code in code blocks by using the “crayon” button you see when you start typing a new message. Lastly, please use the correct forum for your post. This forum is meant for completed scripts people wish to share with the community: “Repository for user submitted functions to extend the toolkit.” The General forum would be more appropriate for this post.

Thanks!

Thank you