I am automating an hyper-v vm from outside of the vm
In my scripts I have a checkpoint applied, running the VM and waiting for it to become stable, then copying and running an exe to install an application
After installing the app I want to check the files are installed and the services are running
To do the the latter, I am trying the following
[pre] $s = New-PSSession -VMName $vmName -Credential $Cred
Invoke-Command -Session $s -VMName “Peptide Mam automation” -ScriptBlock {get-service -Name “WatLindisfarneApiService”} [/pre]
This is currently returning
[pre] Invoke-Command : Parameter set cannot be resolved using the specified named parameters.
At C:\Peptide MAM Automation\Check Installation.ps1:18 char:5
- Invoke-Command -Session $s -VMName “Peptide Mam automation” -Scri …
-
- CategoryInfo : InvalidArgument: (
[Invoke-Command], ParameterBindingException - FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.InvokeCommandCommand [/pre]
Does anyone know what the correct syntax or code I should be using please?
Thanks