Microsoft Virtualization Discussions
Microsoft Virtualization Discussions
Hello,
we just want to get daily Sysinfo-File from multiple filers.
I started with this
foreach ($filer in Get-Content e:\dfsbackup\Netapp\filers.txt) { Connect-NaController -Name $filer;
Get-NaSystemInfo
Get-NaOption
Get-NaNetActiveConfig
Get-NaNetInterface
Get-NaNetVif
Get-NaNetRoute
Get-NaNetVlan
Get-NaVol
Get-NaCifsShare
Get-NaSnapmirror
Get-NaNfsExport }
Out-File e:\dfsbackup\Netapp\ <-- and here is my Problem !
I want a file for each filer and every day.
I try a lot but I think something is blocking me .
Thanks for any advise
Claus
Solved! See The Solution
Hey Claus,
How about something like.. .
$outputFolder = "e:\dfsbackup\Netapp" foreach ($filer in Get-Content e:\dfsbackup\Netapp\filers.txt) { $file = "{0}\{1}_{2}" -f $outputFolder, $filer, (Get-Date -UFormat "%d%h%y") Connect-NaController -Name $filer Get-NaSystemInfo | Out-File -FilePath $file -Encoding ascii Get-NaOption | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetActiveConfig | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetInterface | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetVif | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetRoute | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetVlan | Out-File -Append -FilePath $file -Encoding ascii Get-NaVol | Out-File -Append -FilePath $file -Encoding ascii Get-NaCifsShare| Out-File -Append -FilePath $file -Encoding ascii Get-NaSnapmirror | Out-File -Append -FilePath $file -Encoding ascii Get-NaNfsExport | Out-File -Append -FilePath $file -Encoding ascii }
~Glenn
Hey Claus,
How about something like.. .
$outputFolder = "e:\dfsbackup\Netapp" foreach ($filer in Get-Content e:\dfsbackup\Netapp\filers.txt) { $file = "{0}\{1}_{2}" -f $outputFolder, $filer, (Get-Date -UFormat "%d%h%y") Connect-NaController -Name $filer Get-NaSystemInfo | Out-File -FilePath $file -Encoding ascii Get-NaOption | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetActiveConfig | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetInterface | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetVif | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetRoute | Out-File -Append -FilePath $file -Encoding ascii Get-NaNetVlan | Out-File -Append -FilePath $file -Encoding ascii Get-NaVol | Out-File -Append -FilePath $file -Encoding ascii Get-NaCifsShare| Out-File -Append -FilePath $file -Encoding ascii Get-NaSnapmirror | Out-File -Append -FilePath $file -Encoding ascii Get-NaNfsExport | Out-File -Append -FilePath $file -Encoding ascii }
~Glenn
Thanks
looks better .
But I got this error message:
At C:\Users\axxxxxx\AppData\Local\Temp\2\8e4faf37-77ca-4563-9bde-4b94f2751fc2.ps1:7 char:32
+ Get-NaSystemInfo | Out-File <<<< -FilePath $file -Encoding ascii
+ CategoryInfo : OpenError: (:) [Out-File], NotSupportedException
+ FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
For each command.
Any Ideas ?
Claus
Hey Claus,
Try it now there was a bug in the filename generation.
~Glenn
Great THX It works