Yes y'all can. PowerShell is indeed powerful. In social club to practice a novel spider web site y'all remove to import the webadministration module using this import-module statement. However, y'all should launch Powershell amongst administrator privileges.
Import-Module webadministration
After running the to a higher house in addition to if in that place are no errors run the next contestation to practice a novel website (TestSite)is this:
New-WebSite -Name TestSite -Port eighty -HostHeader TestSite -Physical Path "$env:systemdrive\inetpub\testsite"
This volition spawn an error, if the folder testsite does non be inwards the inetpub directory. Create the folder starting fourth dimension in addition to and therefore run the New-Website dominance every bit above.
----------
New-WebSite : Parameter 'PhysicalPath' should betoken to existing path.
At line:3 char:1
+ New-WebSite -Name TestSite -Port eighty -HostHeader TestSite -PhysicalPat ...
+
+ CategoryInfo : NotSpecified: (:) [New-Website], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.IIs.PowerShell.Provider.NewWebsiteCommand
---------------------------
You tin verify the TestSite y'all created inwards IIS Manager every bit shown.
IIS_TestSite
Import-Module webadministration
After running the to a higher house in addition to if in that place are no errors run the next contestation to practice a novel website (TestSite)is this:
New-WebSite -Name TestSite -Port eighty -HostHeader TestSite -Physical Path "$env:systemdrive\inetpub\testsite"
This volition spawn an error, if the folder testsite does non be inwards the inetpub directory. Create the folder starting fourth dimension in addition to and therefore run the New-Website dominance every bit above.
----------
New-WebSite : Parameter 'PhysicalPath' should betoken to existing path.
At line:3 char:1
+ New-WebSite -Name TestSite -Port eighty -HostHeader TestSite -PhysicalPat ...
+
+ CategoryInfo : NotSpecified: (:) [New-Website], ArgumentException
+ FullyQualifiedErrorId : System.ArgumentException,Microsoft.IIs.PowerShell.Provider.NewWebsiteCommand
---------------------------
You tin verify the TestSite y'all created inwards IIS Manager every bit shown.
IIS_TestSite
Komentar
Posting Komentar