Reputation: 75
i try to run this script in powercli V.11 but i have always des mistakes.
$vm= "server"
$adminGuest="root"
$adminGuestPwd="pass"
$command = " df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }'"
Invoke-VMScript -vm $vm -ScriptText $command -GuestUser $adminGuest -GuestPassword $adminGuestPwd -ScriptType Bash
i don't know how can i integrate this script in my code df -H | grep -vE '^Filesystem|tmpfs|cdrom' | awk '{ print $5 " " $1 }'
Thnks
Upvotes: 1
Views: 989
Reputation: 21
Double quotes in awk command are confusing PowerCLI code check. If you try the command without double quotes in awk, you still won't get the result you're expecting as awk is not parsing the data properly.
Maybe you can collect info with Invoke-VMScript and then parse it somehow with Powershell.
$command = " df -H | grep -vE '^Filesystem|tmpfs|cdrom' "
$output = Invoke-VMScript -vm $vm -ScriptText $command -GuestUser $vCUser -GuestPassword $vCPass -ScriptType Bash
$output.ScriptOutput
Upvotes: 1