Mainos / Advertisement:

Powershellscript

Kohteesta Taisto
Versio hetkellä 30. tammikuuta 2015 kello 15.22 – tehnyt Johannes (keskustelu | muokkaukset)
Siirry navigaatioon Siirry hakuun

Powershellillä voi tehä kaikkee kivaa

Import-Module NetAdapter
$netadapter = Get-Netadapter -Name Ethernet
$netadapter | Set-NetIPInterface -DHCP Disabled
$netadapter | New-NetIPAddress -AddressFamily IPv4 -IPAddress 192.168.7.100 -PrefixLength 24 -Type Unicast -DefaultGateway 192.168.7.1
Set-DnsClientServerAddress -InterfaceAlias Ethernet -ServerAddresses 192.168.7.100
Rename-Computer Wcore -Restart

Konffaa verkon ja muuttaa nimen


Get-WindowsFeature AD-Domain-Services
Install-WindowsFeature -Name AD-Domain-Services 


Set-ExecutionPolicy remotesigned -force
Import-Module ADDSDeployment
Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath C:\Windows\NTDS -DomainMode Win2012 -DomainName core.local -DomainNetbiosName  CORE -ForestMode Win2012 -InstallDns:$true -LogPath C:\Windows\NTDS -NoRebootOnCompletion:$false -SysvolPath C:\Windows\SYSVOL -Force:$true


käyttäjiä

Luo ou:n "testi" ja sen sisään kaksi ryhmää: testaus ja koneet. Sitten luo viisi käyttäjää joilla on kotikansio verkkojaossa ja ne mäppäytyy ja liittää ne testaus ryhmään.

New-ADOrganizationalUnit -Name "testi"
New-ADGroup -Name "testaus" -GroupScope Global -Path "ou=testi,dc=core,dc=local"
New-ADGroup -Name "koneet" -GroupScope Global -Path "ou=testi,dc=core,dc=local"
New-ADUser -Name "testi1" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
New-ADUser -Name "testi2" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
New-ADUser -Name "testi3" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
New-ADUser -Name "testi4" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
New-ADUser -Name "testi5" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
Add-ADGroupMember -Identity "testaus" -Members testi1,testi2,testi3,testi4,testi5
Mainos / Advertisement: