I'm using task scheduler to try and run a ps1 file. I can't get the arguments right. I've tried the following with no success:
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command import-module ActiveDirectory -file "C:\TEST.ps1"
%windir%\system32\WindowsPowerShell\v1.0\powershell.exe -command "&{import-module ActiveDirectory;C:\TEST.ps1}"
powershell -command import-module ActiveDirectory -command - < c:\TEST.ps1
%systemroot%\system32\WindowsPowerShell\v1.0\powershell.exe “C:\TEST.ps1"
Anyone got any suggestions? Thanks in advance!