I am trying to run C:\PowerShell\scripts\CheckForLockedInstallers.ps1 and the action is failing:
.\CheckForLockedInstaller.ps1 : The term '.\CheckForLockedInstaller.ps1' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I don't understand where the path is gone to. Does the action only execute scripts in the same folder as itself?
# get the path of the local installer on SERVERNAME $localFile = $exeName $localFile = $localInstaller.Replace($remoteRoot,$localRoot)
if ($openFile -eq $localFile) { Write-Host "Locked File Detected!" # email details #$to = "$userID@domain.com" $dateTime = Get-Date -Format g $subject = "Warning: locked file on $serverName - $dateTime" $body = "USER: $userID " $body += "FILE: $exeName " $body += "ID: $fileID " $body += "LOCKS: $locks " $body += "WARNING: This file is currently locked and may cause the build to fail. " $body += "The lock will be broken at the end of the build to prevent failure. " $body += "You have 60-90 minutes before this happens. Please ensure the file is unlocked to prevent any data loss. " $body += "
" $body += "Automated email sent from computer: $env:COMPUTERNAME"
I have created a FinalBuilder project with your script and haven’t the issue your experiencing. Possibly its to do with the way in which the path is being defined. Is the script specified in a variable at all? Also are there any other actions which execute prior which are working on the same directory?
I tried this on one of my build machines and it is working.
I think it might be related to our “My Documents”, “Favorites”, etc. being stored on a network location. This means the PowerShell profile is on a network path as well. It might be causing an issue.
I can see what the issue could be potentially. So if I understand you correctly the PowerShell profile could be using UNC paths. I am wondering if any other part of what is occurring here is also on a UNC path. E.g. the current directory of the FinalBuilder script, the directory the FinalBuilder script lives in, or directories which are mapped to UNC paths.
I will test this here locally today and see what I get. From memory FinalBuilder does some manipulation with regards to UNC paths to avoid some issues.
After testing using a powershell profile I believe I am still missing some pieces to this puzzle. Would you be able to send your project, or a screen shot of the settings your using in the powershell action to support? I believe this will give me the last insights I require for a solution here.
I was also wondering if you could send your FinalBuilder project into support? Mainly to see what else the script is doing and what the options are on the script action itself.