Copy to Clipboard
$bytes = 50KB
[System.Security.Cryptography.RNGCryptoServiceProvider] $rng = New-Object System.Security.Cryptography.RNGCryptoServiceProvider
$rndbytes = New-Object byte[] $bytes
$rng.GetBytes($rndbytes)
$Name = "$($bytes / 1024 )KB.bin"
if ( $bytes -ge ( 1024 * 1024 ) ){ $Name = "$($bytes / 1024 / 1024 )MB.bin" }
[System.IO.File]::WriteAllBytes("C:\Tools\TestFiles\Random\$($Name)", $rndbytes)
|