Horje
join computer to domain powershell script Code Example
join computer to domain powershell script
$dc = "ENTERPRISE"
$pw = "Password123" | ConvertTo-SecureString -asPlainText -Force
$usr = "$dc\T.Simpson"
$pc = "WKS034, WKS052, WKS057" # Specify the computers that should be joined to the domain.
$creds = New-Object System.Management.Automation.PSCredential($usr$pw)
Add-Computer -ComputerName $pc -LocalCredential $pc\admin -DomainName $dc -Credential $creds -Restart -Force
join computer to domain powershell script
Remove-ADObject -Identity "WKS932"
join computer to domain powershell script
$dc = "ENTERPRISE" # Specify the domain to join.
$pw = "Password123" | ConvertTo-SecureString -asPlainText –Force # Specify the password for the domain admin.
$usr = "$dc\T.Simpson" # Specify the domain admin account.
$creds = New-Object System.Management.Automation.PSCredential($usr,$pw)
Add-Computer -DomainName $dc -Credential $creds -restart -force -verbose # Note that the computer will be restarted automatically.
join computer to domain powershell script
New-ADComputer –Name “WKS932” –SamAccountName “WKS932”
join computer to domain powershell script
Get-Content C:\scripts\computersfordeletion.txt | % { Get-ADComputer -Filter { Name -eq $_ } } | Remove-ADObject -Recursive
join computer to domain powershell script
$File="C:\scripts\Computers.csv" # Specify the import CSV position.
$Path="OU=Devices,DC=enterprise,DC=com" # Specify the path to the OU.
Import-Csv -Path $File | ForEach-Object { New-ADComputer -Name $_.Computer -Path $Path -Enabled $True}
join computer to domain powershell script
$stale = (Get-Date).AddDays(-30) # means 30 days since last logon, can be changed to any number.

Get-ADComputer -Property Name,lastLogonDate -Filter {lastLogonDate -lt $stale} | FT Name,lastLogonDate

Get-ADComputer -Property Name,lastLogonDate -Filter {lastLogonDate -lt $stale} | Remove-ADComputer
join computer to domain powershell script
$dc = "ENTERPRISE"
$pw = "Password123" | ConvertTo-SecureString -asPlainText -Force
$usr = "$dc\T.Simpson"
$pc = "R07GF"
$creds = New-Object System.Management.Automation.PSCredential($usr,$pw)
Remove-Computer -ComputerName $pc -Credential $creds –Verbose –Restart –Force




Shell

Related
screen sharung zoom linux x11 Code Example screen sharung zoom linux x11 Code Example
change webmail user password Code Example change webmail user password Code Example
copy a file from home directory to other directory in linux Code Example copy a file from home directory to other directory in linux Code Example
sh add Code Example sh add Code Example
delete lines that contain a pattern in unix Code Example delete lines that contain a pattern in unix Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
16