#Read-Host -AsSecureString | ConvertFrom-SecureString | Out-File C:\test\secure.dat
$DomainName = "Domain Name"
$OUpath = "OU=TargetOU,DC=TargetDC,DC=com"
$Username = "DomainJoinAccount"
$PW = Get-Content C:\test\Secure.dat
$SecurePW = ConvertTo-SecureString $PW
$Credential = New-Object System.Management.Automation.PSCredential($Username,$SecurePW)
Add-Computer -DomainName $DomainName -OUPath $OUpath -Credential $Credential
shutdown /s /t 60
Remove-Item C:\test\secure.dat
Remove-Item C:\Temp\DomainJoin.ps1
반응형
'Computer > Windows' 카테고리의 다른 글
Windows Powershell 하위폴더 및 파일 이름 접두에 일괄 이름 추가 (0) | 2025.02.26 |
---|---|
한영키 변경 레지스트리 (0) | 2025.02.05 |
Windows 10 LayoutModification.xml 파일을 통한 레이아웃 설정 (0) | 2025.02.05 |
Windows 용 Multi Ping tool (0) | 2025.02.04 |
Windows Powershell - Get-FolderSize (0) | 2025.02.04 |