Import-Module WebAdministration
# Discovering IIS app poolsGet-Command -Name *apppool*
# Using the IIS driveGet-ChildItem -Path IIS:\AppPoolsGet-ItemProperty IIS:\AppPools\DefaultAppPool
# Using IIS cmdletGet-IISAppPool
# Finding the
1766 x bekeken
Set-ExecutionPolicy Bypass -Scope Process
# To list all Windows Features: dism /online /Get-Features# Get-WindowsOptionalFeature -Online # LIST All IIS FEATURES: #
1766 x bekeken
# Install IIS and dotnet coreInstall-WindowsFeature "Web-Server","Web-Windows-Auth","Web-ASP","Web-Asp-Net","Web-Asp-Net45" -IncludeManagementTools
$maxAttempts = 30$attemptCount = 0$source = "https://download.visualstudio.microsoft.com/download/pr/633b17e5-a489-4da4-9713-5ddedf17a5f0/5c18f4203e837dd90ba3da59eee92b01/dotnet-hosting-2.1.15-win.exe"$file = "C:\Windows\Temp\dotnet-hosting-2.1.15-win.exe"
Do {$attemptCount++Invoke-WebRequest $source -OutFile $file
1865 x bekeken
Import-Module WebAdministration
# Create the new websiteNew-Website -Name DemoSite -PhysicalPath C:\inetpub\wwwroot\
# Notice all web bindings createdGet-WebBinding
# Find the bindings only on
1920 x bekeken
clear$folderName = (Get-Date).tostring(“dd-MM-yyyy”)$Path = "C:\files\" +$FolderName
if (!(Test-Path $Path)){New-Item -itemType Directory -Path C:\files -Name $FolderName}else{write-host "Folder already exists" -ForegroundColor Red}
1897 x bekeken
$AllServices=Get-Service
foreach ($SVC in $AllServices) { if ( $SVC.status -eq "Stopped" ) { Write-Host $SVC.Name, $SVC.status -ForegroundColor Red} else {Write-Host $SVC.name,
1829 x bekeken
# Update-FileContents.ps1
#Full path of the file$file = 'c:\temp\important_file.txt'
# If the file exists, append a new GUID value in the file.if
2179 x bekeken
# Create-NewFile.ps1
# Full path of the file$file = 'c:\temp\important_file.txt'
#If the file does not exist, create it.if (-not(Test-Path -Path $file -PathType
2062 x bekeken
# Create-NewFileAfterArchive.ps1
# Full path of the file$file = 'c:\temp\important_file.txt'
#Full path to the archiving folder$archiveFolder = "c:\temp\archive_$(get-date -Format 'dd-MMM-yyyy_hh-mm-ss-tt')\"
# If the
2036 x bekeken