Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Import-Module WebAdministration
- New-Item "IIS:SitesDefault Web SiteTest" -type Application
- Set-ItemProperty "IIS:SitesDefault Web SiteTest" -Name applicationPool -Value "DefaultAppPool"
- Set-ItemProperty "IIS:SitesDefault Web SiteTest" -Name physicalPath -Value "D:TempMyWebApp"
- Cannot retrieve the dynamic parameters for the cmdlet.
- Retrieving the COM class factory for component with CLSID
- {688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error:
- 80040154 Class not registered (Exception from HRESULT: 0x80040154
- (REGDB_E_CLASSNOTREG)).
- string script = @"Import-Module WebAdministration
- New-Item ""IIS:SitesDefault Web SiteTest"" -type Application
- Set-ItemProperty ""IIS:SitesDefault Web SiteTest"" -Name applicationPool -Value ""DefaultAppPool""
- Set-ItemProperty ""IIS:SitesDefault Web SiteTest"" -Name physicalPath -Value ""D:Temp_PBWIDestination""";
- using (PowerShell powerShellInstance = PowerShell.Create())
- {
- powerShellInstance.AddScript(script);
- Collection<PSObject> psOutput = powerShellInstance.Invoke();
- if (powerShellInstance.Streams.Error.Count > 0)
- {
- foreach (var e in powerShellInstance.Streams.Error.Select(a => a.Exception).ToArray())
- {
- Console.WriteLine(e);
- }
- }
- }
Add Comment
Please, Sign In to add comment