Automating Add disk to server 2012r2 utilizing powershell script VM orchestrator

I built a power shell script to automate adding disk to server 2012 r2 via VMro and VMra. The script runs and correctly adds the disk. The script also runs commands to search for new disk, initialize, assign drive letter and format with NTFS. The issue I am having is when I log onto the server. I can see the disk was added, but not formated. UAC and disk format opens up and ask If I want to allow format to run and the I have to click on format for it to complete. How do I get around this? Below is the script I am running. Note we are running this under a domain admin account.

param(
[string]$servername,
[int] $addGb,
$username,
$password
)

import VMware PowerCLI module

Get-Module -Name VMware* -ListAvailable | Import-Module

Connect to the vCenter instance

Connect-VIServer test.corp.test.com -User $username -Password $password
Connect-VIServer test.corp.test.com -User $username -Password $password

Retrieve server object

$server = Get-VM -Name $servername

Add new drive

$server | New-HardDisk -CapacityGB $addGb

#region –> Call an invoke to extend the OS with loop (no reboot required)
Invoke-Command -ComputerName $server -ScriptBlock {
Update-HostStorageCache
$VolumeNumber = (Get-Disk | where {$_.partitionstyle -eq ‘raw’}).Number
Get-Disk -Number $VolumeNumber | Initialize-Disk -PartitionStyle GPT
New-Partition -DiskNumber $VolumeNumber -UseMaximumSize -AssignDriveLetter | Format-Volume -FileSystem NTFS -Confirm:$false -Force
}
“Guest OS Disk successfully Added and partioned”

You are missing ’ | ’ between commands Initialize-Disk and New-Partition
Probably New-Partition is not getting executed