-
-
Save fenneh/2818594 to your computer and use it in GitHub Desktop.
Powershell.exe -ExecutionPolicy Bypass -file \\my.domain.share\netlogon\Scripts\InstallPonies.ps1 |
This doesn't actually work FWIW
It's 8 years old - pretty sure it used to :) Not had to do it for a long time.
I actually think it might more be AD GP than anything...it was a cluster.
I understand that this is an older script, but since I stumbled upon it, while researching methods of Bypassing UNC Paths, I thought I'd leave a comment, as I'm sure others will follow.
One method, that I used to use often, in relation to Batch Scripts, was to utilize the PUSHD & POPD Commands.
Microsoft PUSHD Command:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/pushd
Microsoft POPD Command:
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/popd
However, in relation to PowerShell, the Push-Location & Pop-Location Cmdlets, can be utilized.
Microsoft PowerShell Push-Location Cmdlet:
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/push-location?view=powershell-7.3
Microsoft PowerShell Pop-Location Cmdlet:
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/pop-location?view=powershell-7.3
Push-Location -Path $PSScriptRoot
Powershell.exe -ExecutionPolicy Bypass -File "$((Get-Location).path)\InstallPonies.ps"
Pop-Location
That said, if anyone comes along looking for a potential method of bypassing UNC Paths, in PowerShell, I'd experiment with this method, a bit.
This doesn't actually work FWIW