Programming + ScriptingPowershell Create files with random data in them of a specific size Updated August 11 2024
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)




©2024 - Some portions of this website are Copyrighted.
Your IP: 3.149.254.25     Referring URL:
Browser: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Terms and Conditions, Privacy Policy, and Security Policy