[Solved] PowerShell Active Directory Login Script Auto-Build


For Future reference to anybody who wants to do this.

I’ve managed to resolve it myself after some playing around.

$NewName = $SAMAccountName
$extension = ".bat"
$FileName = "$SAMAccountName$extension"
$ScriptDrive = "\\IPREMOVED\scripts"

Write-Output "
BAT CONTENTS" `n`n|FT -AutoSize >>LoginScript.txt

Get-ChildItem LoginScript.txt | Rename-Item -NewName $FileName 
Move-Item -Path ".\$FileName" -Destination $ScriptDrive

solved PowerShell Active Directory Login Script Auto-Build