Uninstalled the old PS module, downloaded the nuget package for the new 22.2 SqlServer, copied the files over the server which is offline, extracted the files into the modules folder but SQL Server is still referring to the old one rather than the new version.
A basic example of Import-Module -Name SqlServer will run successfully when executed in ISE but not as an SQL Agent job step. Error message:
The corresponding line is 'import-module SQLPS -Version 15.0'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'The specified module 'SQLPS' with version '15.0' was not loaded because no valid module file was found in any module directory. ' A job step received an error at line 1 in a PowerShell script. The corresponding line is 'SQLSERVER:'. Correct the script and reschedule the job. The error information returned by PowerShell is: 'The term 'SQLSERVER:' 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. '. Process Exit Code -1. The step failed.
Modules, paths and versions are as follows:
Can someone help me in setting up SQL Server or PS module so that the agent can import the new module successfully?
Thank you

#NOSQLPSon the first line of the PowerShell job?#NOSQLPSis mentioned in the documentation at Run Windows PowerShell Steps in SQL Server Agent.