10
votes

PowerShell + WebAdMinistration - Comment obtenir le site Web de l'application Web?

J'écris un script PowerShell pour effectuer certaines fonctions administratives dans IIS 7.5.

get-website | where {test-path "iis:\sites\$_.name\MyApp"}


0 commentaires

3 Réponses :


19
votes

C'est ainsi que vous pouvez obtenir le nom du site: xxx

ou même plus court: xxx


1 commentaires

Cela ne fonctionne pas dans PowerShell 7 + WindowsCompatibilittibilité: InvalidOpération: Invalidoperation: l'invocation de la méthode a échoué parce que [désériialized.microsoft.iis.powershell.framework.configurati ongiment # Appli cation] ne contient pas de méthode nommée "GetParentElement".



6
votes

Je n'ai pas creusé pourquoi, mais si vous utilisez un astérisque ou une note d'interrogation n'importe où dans la chaîne, cela fonctionne comme une base générique et retourne comme tel.

Ie P>

get-website -name '?myapp'

Name   ID State   Physical Path Bindings
----   -- -----   ------------- --------
amyapp 13 Stopped C:\anetpub    http:*:81:


0 commentaires

5
votes

Essayez ceci xxx

Ceci vous donnera tous les noms des applications Web, vous pouvez parfois avoir plus d'un nom pour une seule application Web.

pour Plus d'informations Voir le lien

http://nisanthkv.blog.com/2012/07/06/Name-Of-Web-Applications-Utilisation-powershell/

espérons que cela aide.


0 commentaires