Skip to content

Commit

Permalink
Fixed problems with not ConfigureServer, parameter name in help examp…
Browse files Browse the repository at this point in the history
…le and now using a longer than 14 character password for the Windows user.
  • Loading branch information
peter committed Jun 29, 2017
1 parent 25f5ef6 commit b685ee4
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions New-DemoFtpSite.ps1
Expand Up @@ -68,11 +68,13 @@ Begin

$Assembly = Add-Type -AssemblyName System.Web
# generate a ramdom password
# 14 chars is max for net user, fix?
$password = [System.Web.Security.Membership]::GeneratePassword(14,2)
# 14 chars is max for net user, fix, use /Y now we can use more than 14
$password = [System.Web.Security.Membership]::GeneratePassword(24,2)

# create a user, should only be in guests, that's enough
& net user $FTPIdenityName $password /ADD /ACTIVE:YES /FULLNAME:"FTP Service Account" /EXPIRES:NEVER /Comment:"Account for running FTP Service COM+ application" /PASSWORDCHG:NO
& net user $FTPIdenityName initialPassword12354 /ADD /Y /ACTIVE:YES /FULLNAME:"FTP Service Account" /EXPIRES:NEVER /Comment:"Account for running FTP Service COM+ application" /PASSWORDCHG:NO
# set the new password, even if the user already exists.
& net user $FTPIdenityName $password /Y
# in my tests the password never expired for this user, but better to check
& net localgroup guests $FTPIdenityName /ADD
& net localgroup users $FTPIdenityName /DELETE
Expand Down Expand Up @@ -145,7 +147,7 @@ Process
{
if ($PrepareServer)
{
# SetupFeatures
SetupFeatures
ConfigureServer
}

Expand Down Expand Up @@ -174,7 +176,7 @@ Process
New-DemoFtpSite.ps1 -siteName TestFTPSite -siteRoot "C:\ftproot" -SiteAccess "Modify"
Creates a new FTP site and allows IIS Manager users
.EXAMPLE
New-DemoFtpSite.ps1 -siteName TestFTPSite -user "susan" -userpassword "*******" -userAccess "Read"
New-DemoFtpSite.ps1 -siteName TestFTPSite -username "susan" -userpassword "*******" -userAccess "Read"
Adds a IIS manager user and allows access to the ftp site.
.NOTES
Tested on Windows Server 2012 R2
Expand Down

0 comments on commit b685ee4

Please sign in to comment.