Skip to content

ConvertTo UncPath

Mateusz Czerniawski edited this page Feb 20, 2018 · 3 revisions

ConvertTo-UncPath

PPoShTools -> ConvertTo-UncPath.ps1

Synopsis

A simple function to convert a local file path and a computer name to a network UNC path.

Syntax

ConvertTo-UncPath [-LocalFilePath] <String> [-ComputerName] <String[]> 
[<CommonParameters>]

Parameters

-LocalFilePath<String>

A file path ie. C:\Windows\somefile.txt

  • PipelineInput: true (ByValue, ByPropertyName)
  • Required: true

-ComputerName<String[]>

One or more computers in which the file path exists on

  • PipelineInput: true (ByValue, ByPropertyName)
  • Required: true

Examples

Example 1

ConvertTo-UncPath -LocalFilePath 'c:\adminTools\SomeFolder' -ComputerName 'SomeRemoteComputer'

\SomeRemoteComputer\c$\adminTools\SomeFolder

Example 2

ConvertTo-UncPath -LocalFilePath 'c:\adminTools\SomeFolder' -ComputerName 'SomeRemoteComputer','SomeAnotherComputer'

\SomeRemoteComputer\c$\adminTools\SomeFolder \SomeAnotherComputer\c$\adminTools\SomeFolder