Powershell IIS automation -


i powershell noob. trying learn it.

i want physical path of iis website. i.e. if have website on iis wish physical path of website , try rename text file in directory.

i tried below commands did not help.

$sitename = (get-webapplication -name 'yourapp').getparentelement()['physicalpath'] 

or

(get-website -name "default web site").physicalpath 

am missing something?

you have import module webadministration using import-module cmdlet. (text file) item using get-item cmdlet , rename using rename-item.

here example renames file named file.txt myfile.txt myapplication site within default web site:

import-module webadministration get-item 'iis:\sites\default web site\myapplication\file.txt' |      rename-item -newname 'myfile.txt' 

Comments