Reputation: 515
Editor's note: The OP believes to have encountered a case where Out-File -Append
, against expected behavior, does not create the target file on demand.
If this is indeed the case, it would be a bug.
There is no known reproducible case at this point.
The script runs fine but the file never shows up. I have a share with the proper rights but nothing is showing up. Please advise.
$machinename = Get-WmiObject -Class Win32_ComputerSystem
$MachineFinalName = $machinename.Caption
$wsus = Get-Service -name wuauserv
if ($wsus.Status -eq 'Stopped')
{
$MachineFinalName | Out-File -FilePath \\192.168.1.200\Service_Results\serviceoff.txt -Append
}
Upvotes: 0
Views: 45
Reputation: 515
I figured it out. I had to create the file in the server share and it works perfectly.
Upvotes: 1