Mainos / Advertisement:

Powershellscript

Kohteesta Taisto
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


ad ja käyttäjiä

Install-WindowsFeature
AD-Domain-Services
DNS
Install-ADDSforest
Add-DnsServerPrimaryZone -NetworkId "192.168.0.0/24" -ReplicatioScope "Forest"


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


dhcp

Install-WindowsFeature -IncludeManagementTools "DHCP"
Add-DHCPServerSecurityGroup 
Restart-Service -Name DHCPServer –Force
Add-DhcpServerv4Scope -Name "Friendly Name of Scope" -StartRange 10.10.10.1 -EndRange 10.10.10.254 -SubnetMask 255.255.255.0

Add-DhcpServerInDC -DnsName “DhcpServer.DomainName.com”

Set-DhcpServerv4Binding -BindingState $true -InterfaceAlias “Ethernet”

Mainos / Advertisement: