I need to copy template folders over to inetpub\wwwroot via powershell. I have access and users of the tool should have access.
When I manually copy files I have to confirm via the admin confirm dialog. What’s a workaround in powershell to do this?
$sourceroot = "C:\Users\a_user\Desktop\Projects\IIS Scripting\Templates\"
$sourcepath = Join-Path $sourceroot "Template"
$inetroot = "C:\inetpub\wwwroot"
$destination = Join-Path $inetroot "NewApp"
if(Test-Path $destination){ Remove-Item $destination -recurse }
Write-Host $destination
Copy-Item $sourcepath -destination $destination -recurse
I ended up wrapping it in a bat file:
then I right-click the bat file and run as administrator and I’m set