#Configure the folder where the files are which should be uploaded
$Directory=”C:\MyFolder”#FTP server configuration
$ftpserver = “ftp://myftpserver.myurl.com/optionalpath/”
$username = “FTPUSER”
$password = “FTPPASS”$webclient = New-Object System.Net.WebClient
$webclient.Credentials = New-Object System.Net.NetworkCredential($username,$password)
#Copy each file which type is *.tx*
foreach($file in (dir $Directory “*.tx*”)){
“Uploading $file…”
$uri = New-Object System.Uri($ftpserver+$file.Name)
$webclient.UploadFile($uri, $file.FullName)
}
Tag: Powershell
Promote Domain Controller with Powershell
Domain Controller promotion can also be done with PowerShell script:
#
# PowerShell script for Domain Controller Deployment
#
Import-Module ServerManager
Add-WindowsFeature AD-Domain-Services
Import-Module ADDSDeployment
Install-ADDSDomainController `
-NoGlobalCatalog:$false `
-CreateDnsDelegation:$false `
-CriticalReplicationOnly:$false `
-DatabasePath “C:\Windows\NTDS” `
-DomainName “YOUDomainFQDN” `
-InstallDns:$true `
-LogPath “C:\Windows\NTDS” `
-NoRebootOnCompletion:$false `
-ReplicationSourceDC “CHANGEMEIMAHOST.FQDN” `
-SiteName “CHANGEMEIMASITE” `
-SysvolPath “C:\Windows\SYSVOL” `
-Force:$true
Discover FSMO Roles with PowerShell
Import-Module ActiveDirectory
Get-ADForest <domainnameFQDN> | Format-Table SchemaMaster,DomainNamingMaster
Get-ADDomain <domainnameFQDN> | Format-Table PDCEmulator,RIDMaster,InfrastructureMaster