Hi Luc,
if yu could suggest something on following .
one task has been scheduled to run health check script which runs fine but not getting report in provided path .
One thing you could check is the account under which the scheduled script runs.
Does it have permission to write in that location?
For further analysis I would need to see how the scheduled task is defined and how the script writes the report.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
$user = 'xyz\user1'
$pswd = 'password1'
$sAction = @{
Execute = 'Powershell.exe'
Argument = '-NoProfile -WindowStyle Hidden -File c:\HC\hc.ps1'
}
$action = New-ScheduledTaskAction @sAction
$sTrigger = @{
Daily = $true
At = '10:00am'
}
$trigger = New-ScheduledTaskTrigger @sTrigger
$sTask = @{
Action = $action
Trigger = $trigger
User = $user
Password = $pswd
TaskName = 'vfalpp_HC'
Description = 'vfalpp_hc'
RunLevel = 'Highest'
}
$task = Register-ScheduledTask @sTask
above script is used to schedule task .
xyz\user1 is part of domain admins and domain users .
the script is health check powershelll script which runs fine in other clientaccounts .
That looks ok at first sight.
Can you add a Start-Transcript to the actual healthcheck script?
And perhaps add some debug lines with Write-Host in the script?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am going to add
Start-Transcript
-Path
C:\HC\Transcript.log
at the very begining of the script however when i manullay run this script it works find and writing to c:\HC folder.
There might be a prompt, or a missing permission, or ...
The transcript might show where the problem is located.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I am not getting anything in that path if i schedule it through task.
nither the ouputnot transcript.log .
Can you add a Write-Host with some text, after the Start-Transcript?
That way we are sure the script is actually producing any out for the transcript.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
i am checking this.
for some reasons write-host is not being displayed on console though i can see transcript.log
however i dont see any report in the specified path .
hope there is no background task being run to delete that file.
The Write-Host should indeed go to the transcript log.
Do a Get-ChildItem before and after you create the file, then we can at least be sure the file is created.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
i am checking this .
well i have write-host just after start-transcript ...
and i can now see text being written on console..
however no report being generated .
I was mentioning getting a directory content listing of the target directory (where the report should go) with Get-ChildItem.
Just before and after you create the report.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have already checked this there are only 2 files in that path .no htmlreport before and after .
Can you attach the script as a file?
I would like to do a test run in my lab.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That seems to be a double-byte format.
Would it possible to attach it in a single-byte format?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
if you could suhhest some article to send in single byte format as i have not done this in past..
Open the file in for example notepad, then make sure to save it in UTF-8 format.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference