Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Placing this code in a scriptblock

$
0
0

Hi All.

I am trying to place the code below in a sriptblock, not sure about the format.

$root_drive = "D"
	New-Partition  -DiskNumber 1 -DriveLetter $root_drive -Size 20GB
	Format-Volume -DriveLetter $root_drive  -FileSystem NTFS -NewFileSystemLabel “D_” -Confirm:$false -Force

In previous examples, I have seen

$scriptblock = $ExecutionContext.InvokeCommand.NewScriptBlock("Remove-DnsServerResourceRecord -ZoneName $ZoneName -ComputerName $DCName -Name $HostName -RecordData $IPv4Address -RRType A -Force")



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>