I have an issue with schedule the power shell script
HTML report is not showing complete out put with schedule
HTML report shows properly if I trigger manually
Exchange 2016 with SMTP
You will have to provide a bit more info on this.
What script are you using?
How are you scheduling it?
What exactly is missing?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Send the script to see where the problem is
What script are you using? - vCheck Report
How are you scheduling it? Program Powershella nd argument as -file "C:\Scripts\vCheck-vSphere-master\vCheck.ps1"
What exactly is missing? - not showing any output of scripts only the shows below info , if we ran manually the scripts from powershell / vsphere cli it gives output
General Information | ||||||||||||||||
General details on the infrastructure | ||||||||||||||||
| ||||||||||||||||
vSwitch and portgroup security settings | ||
All security options for standard vSwitches should be set to REJECT. Distributed vSwitches may require ForgedTrasmits in the default portgroup but should be disabled in other VM Network portgroups unless expressly required. | ||
| ||
VMs by Operating System : 1 | ||||
The following Operating Systems are in use in this vCenter | ||||
| ||||
Plugin Report |
Plugins in numerical order, enabled plugins listed first |
Script working fine only through schedule it gives error , its vcheck report
Under which account does the scheduled task run?
How do you connect to the vSphere Server in the scheduled task? VICredentialStoreItem, hard-coded...?
Did you suppress all 'interactivity'? For example did you disable Depreciation Warning message?
Is there any reason why you are using that rather old PowerCLI version?
That is what the VDS plugin is telling you.
To allow the plugin to detect the guest OS name, requires that VMware Tools are installed inside the guest OS.
Apparently they aren't on the VM you tested against.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Under which account does the scheduled task run? - one service account
How do you connect to the vSphere Server in the scheduled task? VICredentialStoreItem, hard-coded...? no the account has access to vcenter when it runs automatically connects
Did you suppress all 'interactivity'? For example did you disable Depreciation Warning message? - yes
Is there any reason why you are using that rather old PowerCLI version? - it was configured earlier not changed , it was working recently there exchange migration happened 2010 to 2016 and this issue started and they cannot find a reason / fix
That is what the VDS plugin is telling you. - how to use instead of old PowerCLI
To allow the plugin to detect the guest OS name, requires that VMware Tools are installed inside the guest OS.
Apparently they aren't on the VM you tested against. - Tools are available
Let's take this step by step.
Can you first check that sending an email is working, from an interactive session and from a scheduled job?
Use something like the following to perform the tests.
To = 'you@domain'
From = 'me@domain'
Subject = 'Test Email'
SmtpServer = 'mail.domain'
}
Send-MailMessage @sMail
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Yes it is working fine .
When I ran vcheck from vsphere cli I will get complete report in html to mail
"Yes it is working fine ." -> You mean from a scheduled job?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Manual working fine from power cli
schedule not working
Ok, we can conlcude that there is an issue with sending mail via SMTP to the mail server with the account the scheduled task is using.
You said earlier that the scheduled task uses a system account, can you try with the account you use to run the script in interactive mode?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Schedule of test mail works now , just I deleted and create task again .
How are you scheduling it? For the action you should call powershell.exe and then for the arguments you should have -ExecutionPolicy bypass -File C:\path\to\vcheck.ps1. You also want to make sure that you are letting the schedule run while the user isn't logged in, but don't check the do not store password, as I've had problems with the vcheck . They should look kinda like this
I've seen that report blank out like that if you don't have the scheduled task setup correctly.
Thanks , it worked
It works only when ran manually from schedule task , automatic schedule still not shows