logo
down
shadow

Powershell script to create website in IIS


Powershell script to create website in IIS

By : user2955217
Date : November 22 2020, 10:38 AM
wish of those help Can someone help me with creation of website from power shell.Script i have written below is not working . , hey you just have to implement below lines after import modules:-
code :
$iisAppPoolName = "my-test-app"
$iisAppPoolDotNetVersion = "v4.0"
$iisAppName = "my-test-app.test"
$directoryPath = "D:\SomeFolder"


Share : facebook icon twitter icon
Powershell script to create folder, website and deploy using MSDeploy.exe

Powershell script to create folder, website and deploy using MSDeploy.exe


By : David Mattson
Date : March 29 2020, 07:55 AM
seems to work fine I would like to deploy a web application on Windows 2008 R2. I know the separate PowerShell commands to do various tasks. But I would like to put this into a nice PowerShell script. , To answer your questions:
code :
Import-Module WebAdministration

# Check for physical path
$sitePath = "c:\inetpub\MyWebsite"
if (-not (Test-Path -path $sitePath))
{
    New-Item -Path $sitePath -type directory 
}

# Check for site
$siteName = "MyWebSite"
$site = Get-WebSite | where { $_.Name -eq $siteName }
if($site -eq $null)
{
    Write-Host "Creating site: $siteName"
    # Put your New-WebSite code here
}

# Execute your .cmd here
c:\PathToScript\MakeMySite.cmd
Stopping website with powerShell script

Stopping website with powerShell script


By : marko
Date : March 29 2020, 07:55 AM
With these it helps Ive got a script for stopping a site:
code :
Import-Module WebAdministration
Stop-WebSite 'Default Web Site'
Start-WebSite 'Default Web Site'
Create an Azure Website with PowerShell and FTP

Create an Azure Website with PowerShell and FTP


By : user2674630
Date : March 29 2020, 07:55 AM
will help you I need to write a PowerShell script that automatically creates an Azure Website and deploy the content of a local file system. Seems that Azure PowerShell SDK doesn't provide a way to copy files to a website so we want to use FTP as a deploy method. , It seems that now you can access the certificate thumbprint using
code :
$thumbprint = $s.DefaultAccount
#$thumbprint = $s.Certificate.Thumbprint
Function get-AzureWebSitePublishXml
{
    Param(
        [Parameter(Mandatory = $true)]
        [String]$WebsiteName
    )

    # Get the current subscription
    $s = Get-AzureSubscription -Current
    if (!$s) {throw "Cannot get Windows Azure subscription."}

    #$thumbprint = $s.Certificate.Thumbprint #this code doesn't work anymore
    $thumbprint = $s.DefaultAccount
    if (!$thumbprint) { throw "Cannot get subscription cert thumbprint."}

    # Get the certificate of the current subscription from your local cert store
    $cert = Get-ChildItem Cert:\CurrentUser\My\$thumbprint
    if (!$cert) {throw "Cannot find subscription cert in Cert: drive."}

    $website = Get-AzureWebsite -Name $WebsiteName
    if (!$website) {throw "Cannot get Windows Azure website: $WebsiteName."}

    # Compose the REST API URI from which you will get the publish settings info
    $uri = "https://management.core.windows.net:8443/{0}/services/WebSpaces/{1}/sites/{2}/publishxml" -f `
        $s.SubscriptionId, $website.WebSpace, $Website.Name

    # Get the publish settings info from the REST API
    $publishSettings = Invoke-RestMethod -Uri $uri -Certificate $cert -Headers @{"x-ms-version" = "2013-06-01"}
    if (!$publishSettings) {throw "Cannot get Windows Azure website publishSettings."}

    return $publishSettings
}
AWS CodeDeploy Powershell Script fail to create website & Pool in IIS server

AWS CodeDeploy Powershell Script fail to create website & Pool in IIS server


By : Anshuman
Date : March 29 2020, 07:55 AM
it should still fix some issue I have an app that I am deploying using AWS Codedeploy to an EC2 instance running Windows Server 2012 R2 with code deploy agent installed. , Try this script:
code :
if ($PSHOME -like "*SysWOW64*")
{
  Write-Warning "Restarting this script under 64-bit Windows PowerShell."

  & (Join-Path ($PSHOME -replace "SysWOW64", "SysNative") powershell.exe) -File `
    (Join-Path $PSScriptRoot $MyInvocation.MyCommand) @args

  Exit $LastExitCode
}

Import-Module WebAdministration; 
New-Item IIS:\AppPools\MyPool;
New-Item iis:\Sites\MySite -bindings @{protocol='http';bindingInformation=':80:'} -physicalPath c:\DemoApp\MySite;
Set-ItemProperty IIS:\Sites\MySite -name applicationPool -value MyPool
Changing Powershell Script for getting website from IIS to Azure

Changing Powershell Script for getting website from IIS to Azure


By : 길상혁
Date : March 29 2020, 07:55 AM
I think the issue was by ths following , ARM API will only let you access the management plane, or the metadata of the resource.
To list the files you will need to use the VFS API's provided by Kudu: https://github.com/projectkudu/kudu/wiki/REST-API
Related Posts Related Posts :
  • Malware Using .Lnk file to Powershell
  • Powershell Foreach-Object Foreach loop read string from several files and write to one
  • Method Invocation failed system.string error
  • Script to move folders with specific names and characters
  • Azure blob download is incredibly slow using PowerShell (via Get-AzureStorageBlobContent), but fast via Azure Explorer,
  • Is there a way in Powershell to append or prepend the value of a variable to the output of a piplined command
  • How do I pass raw strings to commands through the command line in PowerShell?
  • Converting Get-ChildItem output to string[]
  • Compress-Archive powershell command not known in windows 7
  • Adding a newline (line break) to a Powershell script
  • Import-Csv of huge (13M Rows) filtered using Where-Object with 11k rows
  • Trouble with Expanding $Env:TEMP in start-process MSIEXEC
  • 'New-AzureStorageContext' is not recognized
  • How can I set the Cache-Control when using Write-S3Object?
  • Powershell script not exiting while running via freeSSHd
  • Dot Source a "script" within a Function
  • Update IIS 6 WebSite Credentials via powershell
  • Change initial directory in windows powershell
  • Launching Internet Explorer from a PowerShell script
  • How to call .cmd file as administrator?
  • Task Scheduler with powershell not working
  • Error connecting to Azure VM with VS Online Build Server / Release Management
  • PowerShell grab plaintext from URL and use as variable
  • How to extract exe file without installing it, using powershell?
  • How to quickly check if WMI information can be pulled from a remote computer
  • Putting a specific Powershell Get-Counter Statistic into a variable
  • Nonewline messes up output for Powershell
  • shadow
    Privacy Policy - Terms - Contact Us © ourworld-yourmove.org