Open-AudIT

What's on your network?
It is currently Wed Jan 24, 2018 5:14 pm

All times are UTC + 10 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Feb 24, 2014 4:40 am 
Offline
Newbie

Joined: Thu Apr 25, 2013 11:58 pm
Posts: 28
The need arose to audit all Windows guests in our VM infrastructure. I put together a little PowerCLI script that sends audit_windows_vm.vbs to VM and Invokes cscript via bat to run it.

Code:
##ESX based auditing using Open-AudIT's audit_windows.vbs

#vm_list.txt has one VM guest name per line - can give different lists for different creds using parameters
param(
   [string]$user='user',
   [string]$pass='pass',
   [string]$audit_windows_vm='C:\audit_vms\audit_windows_vm.vbs', #added _vm to distinguish method
   [string]$vm_list='C:\audit_vms\vm_list.txt" ,
   [string]$vm_dir='C:\' #directory script places audit_windows_vm.vbs on guest VM
   )
$audit_vms='C:\audit_vms' #more or less=working directory.
echo $vm_list
$vms = Get-Content $vm_list
Foreach( $vm in $vms )
{
Try
   {
   echo $vm
   $ErrorActionPreference = "Stop"; #Make all errors terminating - catches vm guest authentication
   Copy-VMGuestFile -Source "$audit_vms\audit_windows_vm.vbs" -Destination $vm_dir -VM $vm -LocalToGuest -GuestUser $user -GuestPassword $pass
   Invoke-VMScript -ScriptText "cscript $vm_dir\audit_windows_vm.vbs && exit" -VM $vm -GuestUser $user -GuestPassword $pass -ScriptType Bat
   $vm >> "$audit_vms\logs\success_list.log"
   "$vm was audited successfully"
   }
Catch
   {
   $vm >> "$audit_vms\logs\failed_list.log"
   $Error[0] >> "$audit_vms\logs\errors.log"
   "$vm audit error"
   }
Finally
   {
   echo 'Continuing to next VM'
   }
}
"End of script"


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 24, 2014 5:08 am 
Offline
Newbie

Joined: Thu Apr 25, 2013 11:58 pm
Posts: 28
I was also looking into grabbing VM Host for each guest. Doesn't seem like xml created after audit contains the "Physical Host" value anywhere. Wouldn't really be able to edit the audit results from how I've set it up. Could that information be included in the audit_windows_vm.vbs somewhere, or maybe as a command line argument / parameter?

Mark, will get back to your email soon! : )


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 10 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group