Search
 
SCRIPT & CODE EXAMPLE
 

SHELL

join computer to domain powershell script

$dc = "ENTERPRISE"
$pw = "Password123" | ConvertTo-SecureString -asPlainText -Force
$usr = "$dcT.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 $pcadmin -DomainName $dc -Credential $creds -Restart -Force
Comment

join computer to domain powershell script

$dc = "ENTERPRISE"
$pw = "Password123" | ConvertTo-SecureString -asPlainText -Force
$usr = "$dcT.Simpson"
$pc = "R07GF"
$creds = New-Object System.Management.Automation.PSCredential($usr,$pw)
Remove-Computer -ComputerName $pc -Credential $creds –Verbose –Restart –Force
Comment

join computer to domain powershell script

$File="C:scriptsComputers.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}
Comment

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 = "$dcT.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.
Comment

join computer to domain powershell script

New-ADComputer –Name “WKS932” –SamAccountName “WKS932”
Comment

join computer to domain powershell script

Remove-ADObject -Identity "WKS932"
Comment

join computer to domain powershell script

Get-Content C:scriptscomputersfordeletion.txt | % { Get-ADComputer -Filter { Name -eq $_ } } | Remove-ADObject -Recursive
Comment

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
Comment

PREVIOUS NEXT
Code Example
Shell :: how to access folder using command on git bash terminal 
Shell :: bash ps sort by time 
Shell :: Stderr: VBoxManage.exe: error: UUID 
Shell :: Examples of add-apt-repository and updating the APT cache 
Shell :: how force detached ENI 
Shell :: set up vm arch 
Shell :: /usr/local/psa/var/modules/composer//composer.phar 
Shell :: private repo git history api 
Shell :: LF will be replaced by CLRF 
Shell :: how to save a specific file in stash 
Shell :: Install Deno - PowerShell (Windows) 
Shell :: npm -g mac privileges 
Shell :: windows powershell ise 
Shell :: powerhsell write to output file from multiple jobs 
Shell :: bat configuration file 
Shell :: git grep line only 
Shell :: prepare ansible playbook to setting up production grade server in kubernetes 
Shell :: vim append to line 
Shell :: restart windows computer from mac 
Shell :: nativescript sidedrawer 
Shell :: tar -cxvf other directory 
Shell :: phenix applyncs 
Shell :: how to install wine in ubuntu 
Shell :: iiana github 
Shell :: the folder cannot be copied because you do not have permissions to create it in the destination 
Shell :: heroku Failed to install gems via Bundler when remove gem rails 
Shell :: bash tr squeeze space 
Shell :: termux login single command install 
Shell :: delete file kali linux 
Shell :: ntp service not installed 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =