Options
Powershell script for vmware linux guests
Hi all,
Wondering if I could ask for some advice please. I have a simple script that outputs linux guests date/time (checking for the time drift issue), I've got it to output to a file but its not much use at the moment because I'm not sure how to get it to also echo out the current vm name. Does anyone know if this is possible from within the invoke-vmscript commandlet or even if I pipe it in someway before passing it to the txt file.
Script currently looks like this!
Invoke-VMScript -VM (Get-VM) -GuestCredential (Get-Credential) -HostCredential (Get-Credential) -ScriptText "date" -ScriptType Bash | out-file list.txt
Output currently looks like this!
Wed May 19 14:17:18 BST 2010
Wed May 19 14:17:24 BST 2010
Wed May 19 14:17:52 BST 2010
thanks in advance
Dale
Wondering if I could ask for some advice please. I have a simple script that outputs linux guests date/time (checking for the time drift issue), I've got it to output to a file but its not much use at the moment because I'm not sure how to get it to also echo out the current vm name. Does anyone know if this is possible from within the invoke-vmscript commandlet or even if I pipe it in someway before passing it to the txt file.
Script currently looks like this!
Invoke-VMScript -VM (Get-VM) -GuestCredential (Get-Credential) -HostCredential (Get-Credential) -ScriptText "date" -ScriptType Bash | out-file list.txt
Output currently looks like this!
Wed May 19 14:17:18 BST 2010
Wed May 19 14:17:24 BST 2010
Wed May 19 14:17:52 BST 2010
thanks in advance
Dale
Kind Regards
Dale Scriven
Twitter:dscriven
Blog: vhorizon.co.uk
Dale Scriven
Twitter:dscriven
Blog: vhorizon.co.uk
Comments
-
Optionssambuca69 Member Posts: 262Hi all,
Wondering if I could ask for some advice please. I have a simple script that outputs linux guests date/time (checking for the time drift issue), I've got it to output to a file but its not much use at the moment because I'm not sure how to get it to also echo out the current vm name. Does anyone know if this is possible from within the invoke-vmscript commandlet or even if I pipe it in someway before passing it to the txt file.
Script currently looks like this!
Invoke-VMScript -VM (Get-VM) -GuestCredential (Get-Credential) -HostCredential (Get-Credential) -ScriptText "date" -ScriptType Bash | out-file list.txt
Output currently looks like this!
Wed May 19 14:17:18 BST 2010
Wed May 19 14:17:24 BST 2010
Wed May 19 14:17:52 BST 2010
thanks in advance
Dale
So you want it to write to a file, lets say and then work with the object again and echo it on screen?
You can use tee-object for that.. so you have your script, then pipe it something like: script here | tee-object C:\scripts\MyReport.txt | write-host , etc -
OptionsClaymoore Member Posts: 1,637Any reason why you want to document the time drift rather than fix it?
Synchronizing the Time in the Guest with the Host Operating System -
Optionsdales Member Posts: 225Yes looking to fix the time drift issue but as we still have servers to p2v it would be a script that I would like to run every once in a while just to keep a check on things. Thanks sambuca for the suggestions I'll have a fiddle with that tomorrow when I get back to work.Kind Regards
Dale Scriven
Twitter:dscriven
Blog: vhorizon.co.uk -
Optionsastorrs Member Posts: 3,139 ■■■■■■□□□□Does anyone know if this is possible from within the invoke-vmscript commandlet or even if I pipe it in someway before passing it to the txt file.