Mainos / Advertisement:

Ero sivun ”Powershellscript” versioiden välillä

Kohteesta Taisto
Siirry navigaatioon Siirry hakuun
 
(4 välissä olevaa versiota samalta käyttäjältä ei näytetä)
Rivi 21: Rivi 21:
  
  
=== käyttäjiä ===
+
=== ad ja käyttäjiä ===
  
  New-ADUser -Name uuser -HomeDirectory "\\Wcore\home\%username%" -HomeDrive "K:" -Enabled $true -PasswordNotRequired $true -AccountPassword (Read-Host -AsSecureString "AccountPassword")
+
  Install-WindowsFeature
 +
AD-Domain-Services
 +
DNS
  
 +
Install-ADDSforest
  
  New-ADOrganizationalUnit -Name "taitaja2"
+
Add-DnsServerPrimaryZone -NetworkId "192.168.0.0/24" -ReplicatioScope "Forest"
  New-ADGroup -Name "kayttajat" -GroupScope Global -Path "ou=taitaja2,dc=core,dc=local"
+
 
  New-ADGroup -Name "koneet" -GroupScope Global -Path "ou=taitaja2,dc=core,dc=local"
+
 
  New-ADUser -Name "hermanni1" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
+
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-ADUser -Name "hermanni2" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
+
 
  New-ADUser -Name "hermanni3" -AccountPassword (Read-Host -AsSecureString "AccountPassword") -HomeDirectory "\\Wcore\home\%username%\" -HomeDrive "S:" -Enabled $true
+
  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”

Nykyinen versio 2. helmikuuta 2015 kello 06.44

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: