Function
function Get-RemoteCompFWRules ( [Parameter(Mandatory=$false, Position=0, ParameterSetName="LiteralPath", ValueFromPipelineByPropertyName=$true, HelpMessage="Literal path to core server passed as a network location (\serverrootdirdir)")] [Alias("CSPath")] [ValidateNotNullOrEmpty()] [string[]] $Core_Server_Save_Location) { $file_name = "$Core_Server_Save_Location" + "$(Get-Date -Format yyyy-MM-dd:HH:MM)" + "${env:COMPUTERNAME}-FWRules.txt" Get-NetFirewallRule * | Format-List * >> $file_name }
Running this returns
out-file : The given path's format is not supported. At line:1 char:1 + Get-NetFirewallRule * | Format-List * >> $file_name + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : OpenError: (:) [Out-File], NotSupportedException + FullyQualifiedErrorId : FileOpenFailure,Microsoft.PowerShell.Commands.OutFileCommand
I feel like this is a simple fix but Im not seeing it.
submitted by /u/toe-fu
[link] [comments]
The post [help] Out-File to network path resulting in path error appeared first on How to Code .NET.