GuideProgramming + 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: 18.191.154.250     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