How well with you?
I request an aid created a function that makes backups of virtual machines this function receives two parameters the name of the server and the name of the VM. I need to call function by executing the .ps1 file, I have already tried to execute the file and pass the parameters to function in several ways, but the "powershell" command is executed and no action is performed or the function in the file is not executed, but when I run the function in Powershell ISE or do the dot-source everything works wonders, see below the methods that I have used to call the function:
using the operated "&"
powershell.exe -command "& C: \ script_backup \ Export-Vm.ps1 'SERVED' 'NOMEDAVM'}"
using the operative call "&" and doing dot-source
powershell.exe -command "&