Categories
Sponsors
Archive
Blogroll
Badges
Community
|
Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 5,304 views | 27/02/2010 16:40
You should install Windows File Services to use DirQuota cmdlet in Powershell.
DirQuota Quota Add /Path:"$LogDir" /Limit:$FTPQuota |
DirQuota Quota Add /Path:"$LogDir" /Limit:$FTPQuota
Usage of $FTPQuota is like “100mb”. You can use help to find out more.
Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 4,738 views | 27/02/2010 16:30
First you need to clear default security settings to create your own settings.
Clear-WebConfiguration -Filter /System.FtpServer/Security/Authorization -PSPath IIS: -Location "Default FTP Site/$FTPUserDir" |
Clear-WebConfiguration -Filter /System.FtpServer/Security/Authorization -PSPath IIS: -Location "Default FTP Site/$FTPUserDir"
As I said in earlier posts, $FTPUserDir is the name of the FTP Virtual Site.
Posted in Hosting & IIS7, Windows Powershell, Windows Server | 4 Comments | 11,473 views | 27/02/2010 16:27
Last post, We created a new ftp site on IIS7.5 with Powershell.
Now we set security settings of FTP site with Powershell.
Import-Module WebAdministration
Add-WebConfiguration -Filter /System.FtpServer/Security/Authorization -Value (@{AccessType="Allow"; Users="$FTPUsername"; Permissions="Read, Write"}) -PSPath IIS: -Location "Default FTP Site/$FTPUserDir/$FTPUsername" |
Import-Module WebAdministration
Add-WebConfiguration -Filter /System.FtpServer/Security/Authorization -Value (@{AccessType="Allow"; Users="$FTPUsername"; Permissions="Read, Write"}) -PSPath IIS: -Location "Default FTP Site/$FTPUserDir/$FTPUsername"
My purpose is showing you how to use Powershell to do your works easy. Not explaining IIS7 FTP settings. If you have questions about Security settings of IIS7.5, please mail me. I’m trying to reply all user mails.
Posted in Hosting & IIS7, Windows Powershell, Windows Server | 2 Comments | 25,753 views | 27/02/2010 16:18
It’s really easy to create new ftp web site on IIS7.5 with Powershell WebAdministration module.
Import-Module WebAdministration
New-Item IIS:\Sites\"Default FTP Site"\$FTPUserDir\$FTPUsername -Type VirtualDirectory -PhysicalPath "$LogDir"</dir> |
Import-Module WebAdministration
New-Item IIS:\Sites\"Default FTP Site"\$FTPUserDir\$FTPUsername -Type VirtualDirectory -PhysicalPath "$LogDir"</dir>
$FTPUserDir is the name of the Virtual Directory name. You should use “LocalUser” for standalone machines.
Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 5,827 views | 27/02/2010 16:12
I’ll show you how to create a New Web site on IIS7.5 with a Powershell function.
Function Create-WebSite
{
Param ($LogDir, $Description, $Domain)
$Domain = $Domain.TrimStart("www.")
New-Item IIS:\Sites\$Description -Bindings (@{Protocol="http";BindingInformation="*:80:$Domain"},@{Protocol="http";BindingInformation="*:80:www.$Domain"}) -PhysicalPath "$LogDir\http"
} |
Function Create-WebSite
{
Param ($LogDir, $Description, $Domain)
$Domain = $Domain.TrimStart("www.")
New-Item IIS:\Sites\$Description -Bindings (@{Protocol="http";BindingInformation="*:80:$Domain"},@{Protocol="http";BindingInformation="*:80:www.$Domain"}) -PhysicalPath "$LogDir\http"
}
You can execute our function using with this command:
Create-WebSite -Logdir "C:\inetpub" -Description "My New Web Site" -Domain "www.yusufozturk.info" |
Create-WebSite -Logdir "C:\inetpub" -Description "My New Web Site" -Domain "www.yusufozturk.info"
That’s easy!
Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 7,493 views | 27/02/2010 16:05
It’s really easy to create new web site on IIS7.5 with Powershell WebAdministration module.
Import-Module WebAdministration
New-Item IIS:\Sites\$Description -Bindings (@{Protocol="http";BindingInformation="*:80:$Domain"},@{Protocol="http";BindingInformation="*:80:www.$Domain"}) -PhysicalPath "$LogDir\http" |
Import-Module WebAdministration
New-Item IIS:\Sites\$Description -Bindings (@{Protocol="http";BindingInformation="*:80:$Domain"},@{Protocol="http";BindingInformation="*:80:www.$Domain"}) -PhysicalPath "$LogDir\http"
As you see, you can set Bindings with the same command. Next time, I’ll write a function.
Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 3,967 views | 27/02/2010 16:01
After creating web site directories, you should set ACL settings of directories.
Function Set-IISACL
{
Param ($Username, $LogDir)
$Netbios = "FABRIKAM"
$Account = New-Object System.Security.Principal.Ntaccount("$Netbios\$Username")
$ACL = Get-Acl -Path "$LogDir"
$ACL.SetAccessRuleProtection($True, $True)
Set-Acl -Path "$LogDir" -AclObject $ACL
$Permission = "$Account","ReadAndExecute","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir"
$Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir\db"
$Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir\http\upload"
} |
Function Set-IISACL
{
Param ($Username, $LogDir)
$Netbios = "FABRIKAM"
$Account = New-Object System.Security.Principal.Ntaccount("$Netbios\$Username")
$ACL = Get-Acl -Path "$LogDir"
$ACL.SetAccessRuleProtection($True, $True)
Set-Acl -Path "$LogDir" -AclObject $ACL
$Permission = "$Account","ReadAndExecute","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir"
$Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir\db"
$Permission = "$Account","Modify","ContainerInherit,ObjectInherit","None","Allow"
$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $Permission
$ACL.SetAccessRule($AccessRule)
$ACL | Set-Acl "$LogDir\http\upload"
}
Fabrikam is my Netbios name. If you create your users on Active Directory, you should write your Netbios name of your domain. But on a local machine, you can use your local computer name like “Plesk01\username”.
|