Skip to content

Commit

Permalink
Update Schedule-Remote-Meerkat.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyPhipps authored Nov 29, 2023
1 parent 65d0a1d commit 51f70c0
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Utilities/Schedule-Remote-Meerkat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ $ScriptName = "C:\Meerkat-Task.ps1"
$AtTime = "1/30/2023 1:01:00 AM"

# Create the MSA
$Identity = Get-ADComputer -identity $Server

if(-not $MSAExists) {
Add-WindowsFeature RSAT-AD-PowerShell
Import-Module ActiveDirectory
Expand All @@ -42,13 +44,14 @@ if(-not $MSAExists) {
Add-KdsRootKey -EffectiveTime ((Get-Date).AddHours(-10))
}

$Identity = Get-ADComputer -identity $Server
New-ADServiceAccount -Name $MSAName -Enabled $true -RestrictToSingleComputer -KerberosEncryptionType AES256
Add-ADComputerServiceAccount -Identity $Identity -ServiceAccount $MSAName

Install-ADServiceAccount -Identity ($MSAName + "$")
}

Add-ADComputerServiceAccount -Identity $Identity -ServiceAccount $MSAName
Install-ADServiceAccount -Identity ($MSAName + "$")

Write-Information -InformationAction Continue -MessageData ("`n Computer accounts with access to {0}:`n `t{1}`n" -f $MSAName, $HostServiceAccountBL)

# Create the Scheduled Task

$Action = New-ScheduledTaskAction -Execute "Powershell.exe" -Argument "-ExecutionPolicy Bypass -Windowstyle Hidden -File `"$ScriptName`""
Expand Down

0 comments on commit 51f70c0

Please sign in to comment.