Q6960030: When a PowerShell is executed by ActiveXperts Network Monitor, I get the following error: "The term '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". What is the problem?
Under the hood, ActiveXperts executes all PowerShell checks by executing a command like this:
cmd /q /c "C:\Windows\System32\WindowsPowerShell\v1.0\PowerShell.exe "C:\PROGRA~1\ACTIVE~1\NETWOR~1\scripts\MONITO~2\CPU.PS1"
As you can see, a 8dot3 naming convention is used for powershell files, simply because PowerShell cannot deal with long filenames when used from the command line.
Sometimes, 8dot3 naming convention is DISABLED on the file system, and PowerShell scripts will not work, ending up with the standard PowerShell error: "The term ‘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"
SOLUTION: Enable 8dot3 naming on the filesysten where Network Monitor is installed.
To find out if 8dot3 is enabled on your filesystem, use the standard command line tool FSUTIL:
FSUTIL.EXE 8dot3name query C:
To enable, use:
FSUTIL.EXE 8dot3name set C: 0
You may need top copy files again because 8dot3 names are created upcon copy.
Verify by listing files from the command lne like this:
DIR /X c:
You can see our PowerShell log file(s) if you enable logging for the PowerShell thread(s). To do so, specify a valid log file in registry key:
(and HKLM\Software\ActiveXperts\Network Monitor\Server\Trace\ThreadPowerShell001, ... )
IMPORTANT: You need to restart the service in order for reguistry changes to take effect.(viewed: 100)