Hello All,
I have some .ps1 scripts that I would like to run from a single cmdlet.
Currently in my cmdlet I have the following:
powershell -command "& 'C:\MyScript01.ps1'
This works fine but when I add a second one I get the following error.
powershell -command "& 'C:\MyScript01.ps1'
powershell -command "& 'C:\MyScript02.ps1'
Results
The term 'C:\MyScript02.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.
At line:1 char:2
+ & <<<< 'C:\MyScript02.ps1'
+ CategoryInfo : ObjectNotFound: (C:\vHealthCheck...ndMemReport.ps1:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
How can I add a second line?
That should work, are you sure C:\MyScript02.ps1 exists ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That should work, are you sure C:\MyScript02.ps1 exists ?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I had a space between each line. After removing the space everything worked. Thank you very much...
powershell -command "& 'C:\MyScript01.ps1'
powershell -command "& 'C:\MyScript02.ps1'