search
Categories
Sponsors
VirtualMetric Hyper-V Monitoring, Hyper-V Reporting
Archive
Blogroll

Badges
MCSE
Community

Cozumpark Bilisim Portali
Posted in Hosting & IIS7, Windows Powershell, Windows Server | 1 Comment | 10,806 views | 02/03/2010 12:13

You have to set “Password never expires” for some active directory users like IIS or SCVMM users. To do this with Powershell, we’ll simply use “userAccountControl” property with Powershell.

1
2
3
$User = [ADSI] "LDAP://CN=$Username,$CustomerOU,$FQDN"
$User.Put("userAccountControl", "65536")
$User.SetInfo()

65536 means “Password never expires”. Be careful with LDAP name.


Posted in Hosting & IIS7, Windows Powershell, Windows Server | No Comment | 5,484 views | 02/03/2010 12:06

This is another way to check active directory user with Powershell. I made a function.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
Function Check-ADUser
{
Param ($Username)
 
    $ADRoot = [ADSI]''
    $ADSearch = New-Object System.DirectoryServices.DirectorySearcher($ADRoot) 
    $SAMAccountName = "$Username"
    $ADSearch.Filter = "(&(objectClass=user)(sAMAccountName=$SAMAccountName))"
    $Result = $ADSearch.FindAll()
 
    If($Result.Count -eq 0)
    {
        Write-Host "No such user on the Server" | Out-Null
        $Status = "0"
    }
    Else
    {
        Write-Host "User exist on the Server" | Out-Null
        $Status = "1"
    }
 
    $Results = New-Object Psobject
    $Results | Add-Member Noteproperty Status $Status
    Write-Output $Results    
}

Usage:

Check-ADUser -Username "yusufozturk"

You can use this function with Status property. It’s useful.


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

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,740 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"

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,484 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"

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,755 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>

$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"
}

You can execute our function using with this command:

Create-WebSite -Logdir "C:\inetpub" -Description "My New Web Site" -Domain "www.yusufozturk.info"

That’s easy!