Quantcast
Channel: /r/powershell – How to Code .NET
Viewing all articles
Browse latest Browse all 8793

Running into a stupid UNC Issue

$
0
0

Here’s my snippet:

Invoke-Command –ComputerName $ComputerTarget -Credential (Get-Credential) –ScriptBlock { if (-Not (Test-Path C:TEMP)) { Write-Host "" Write-Host "Temp Folder Doesn't exist, creating folder (C:TEMP)" -ForegroundColor Red -BackgroundColor Black Write-Host "" New-Item -ItemType Directory -Force -Path C:TEMP } else { Write-Host "" Write-Host "Temp Folder Exists, Proceeding" -ForegroundColor Cyan -BackgroundColor Black Write-Host "" Start-Sleep -Seconds 2 } Copy-Item -Path \$FILESERVERFOLDERPROGRAM.msi -Destination C:TEMP } 

So I am trying to install an msi remotely using invoke-command but I keep getting the error:

Cannot find path ‘\$FILESERVERFOLDERPROGRAM.msi’ because it does not exist.

It’s driving me nuts – WinRM is enabled, my account is a domain admin (being passed on invoke) I can’t think of anything that could be wrong. This is only on the invoke command, if I run it locally it’s fine.

Any ideas?

submitted by /u/Rollingprobablecause
[link] [comments]

The post Running into a stupid UNC Issue appeared first on How to Code .NET.


Viewing all articles
Browse latest Browse all 8793

Trending Articles