From ebaae8784defd38da6a7ceefb8d7b0d455407a6a Mon Sep 17 00:00:00 2001 From: walter Date: Mon, 16 Jun 2025 22:58:20 +0000 Subject: [PATCH] Atualizar adoci.ps1 --- adoci.ps1 | 42 ++++++------------------------------------ 1 file changed, 6 insertions(+), 36 deletions(-) diff --git a/adoci.ps1 b/adoci.ps1 index 71f9fb5..1cacec1 100644 --- a/adoci.ps1 +++ b/adoci.ps1 @@ -1,37 +1,11 @@ #ps1_sysnative -######## -# Title: ActiveDirectoryInit.ps1 -# Version & Date: v1 31 Oct 2018 -# Updated: v2 31 Mar 2022 -# Creator: john.s.parker@oracle.com -# Warning: This script is a representation of how to use PowerShell to create an Active Directory Domain controller -# and build the first DC in a new Active Directory Forest. This script creates and uses the domain administrator account -# there are potential for mistakes and destructive actions. USE AT YOUR OWN RISK!! -# This is the first script in the Active Directory Series that will establish the first -# Active Directory Domain Controller. This script will unlock the local administrator account -# this account will become the Domain Administrator. -# -# This script will install the required Windows features that are required for Active -# Directory. This script will install the prerequisites for Active Directory, then create a -# one-time executed script on the login after the reboot. This script will reboot the host -# a total of 2 times to add the windows features, create the forest, and promote the domain controller. -# -# Variables for this script -# $password - this is the password necessary to unlock the administrator account -# - and is used in both runs of the AD build. -# $FullDomainName - the full name for the AD Domain example: CESA.corp -# $ShortDomainName - the short name for the AD Domain example: CESA -# $encrypted - you must encrypt the password so that you can use it as you set up your domain controller -# $addsmodule02 - this is the text block that will be used to create the RunOnceScript that will finish the installation -# - of the domain controller. -# $RunOnceKey - this is the key that will create the command to complete the installation of the domain controller. Try { # -# Start the logging in the C:\DoimainJoin directory +# Start the logging in the C:\DomainJoin directory # Start-Transcript -Path "C:\DomainJoin\stage1.txt" # Global Variables -$password="Password!!" +$password="P@ssw0rd123!!" # Set the Administrator Password and activate the Domain Admin Account # net user Administrator $password /logonpasswordchg:no /active:yes @@ -52,9 +26,9 @@ $addsmodule02 = @" #ps1_sysnative Try { Start-Transcript -Path C:\DomainJoin\stage2.txt -`$password = "Password!!" -`$FullDomainName = "cmgsol.corp" -`$ShortDomainName = "CMGSOL" +`$password = "P@ssw0rd123!!" +`$FullDomainName = "cruvinelmarcal.corp" +`$ShortDomainName = "cruvinelmarcal" `$encrypted = ConvertTo-SecureString `$password -AsPlainText -Force Import-Module ADDSDeployment Install-ADDSForest `` @@ -73,8 +47,6 @@ Install-ADDSForest `` } Catch { Write-Host $_ } Finally { -24 Creating Active Directory Domain Services in Oracle Cloud Infrastructure / version 3.0 -Copyright © 2022, Oracle and/or its affiliates / Public Stop-Transcript } "@ @@ -82,8 +54,7 @@ Add-Content -Path "C:\DomainJoin\ADDCmodule2.ps1" -Value $addsmodule02 # Adding the run once job # $RunOnceKey = "HKLM:\Software\Microsoft\Windows\CurrentVersion\RunOnce" -set-itemproperty $RunOnceKey "NextRun" ('C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -executionPolicy Unrestricted -File ' + -"C:\DomainJoin\ADDCmodule2.ps1") +set-itemproperty $RunOnceKey "NextRun" ('C:\Windows\System32\WindowsPowerShell\v1.0\Powershell.exe -executionPolicy Unrestricted -File ' + "C:\DomainJoin\ADDCmodule2.ps1") # End the logging # } Catch { @@ -92,5 +63,4 @@ Write-Host $_ Stop-Transcript } # Last step is to reboot the local host -# Restart-Computer -ComputerName "localhost" -Force \ No newline at end of file