Free PS1 test files and sample generator
Windows PowerShell scripts. Generate valid .ps1 sample files to test uploads, editors, execution policies and automation tooling.
What is a .ps1 file?
PS1: PowerShell Script. PowerShell scripts drive most modern Windows automation. Execution policy, signing and parsing all sit between a .ps1 file and it actually running, which gives plenty to test.
Why generate a test PS1 file?
- Test execution-policy and script-signing enforcement.
- Verify a parser or linter handles the script.
- Check automation tooling that ingests PowerShell.
What you can put inside a .ps1 file
You get 3 content options for PS1, so the file holds something meaningful rather than random padding: Definitions, Simple statements, With comments. For PS1 these are alternatives, so choose the one that matches what you need to test.
How a .ps1 file is identified
A .ps1 file has no signature at the start. A script is identified by its extension and, on Unix, by a #! on the first line, which is why a byte-order mark breaks it.
How the size lands on the exact byte
The format allows comments, so the padding is comment lines, legal, inert, and visible if you open the file.
Negative testing with broken PS1 files
- Invalid. Identifiable, but wrong inside, so it fails during parsing.
- Corrupted. The leading bytes are destroyed. Same length as the valid file.
- Incomplete. Truncated part-way, so it is genuinely shorter.
- Empty. Chosen under Content rather than File Condition: valid structure, no data.
Which failure to reach for, and what to assert for each, is covered in how to make a corrupted file for testing. For upload limits and type checks see testing file upload validation, and for this format's encodings, UTF-16 and BOM test files.
Sample PS1 content
# sample
function Test-Item0 { return 137 }
$v0 = 137This shows the shape of the file. Your download is generated fresh at the size you choose, so the values will differ.
How to open and verify the file
Parse without executing: `[System.Management.Automation.Language.Parser]::ParseFile(...)`, or lint with PSScriptAnalyzer.
Media type application/x-powershell · extension .ps1 · category Scripts & OS
Generate a .ps1 file → · questions about sizes, privacy or cost are answered on the site FAQ.
Frequently asked questions about PS1 files
What identifies a .ps1 file?
Nothing at the start of the file does. A script is identified by its extension and, on Unix, by a #! on the first line, which is why a byte-order mark breaks it.
How can a .ps1 file be an exact number of bytes?
The format allows comments, so the padding is comment lines, legal, inert, and visible if you open the file.
What can go inside the PS1 file?
There are 3 content options for .ps1: Definitions, Simple statements, With comments. For PS1 these are alternatives, so pick the one matching what you need to test.
Can I download several broken PS1 files at once?
Yes, select more than one File Condition and you get one ZIP containing a .ps1 per condition, each named after its condition.
Can the PS1 file use UTF-16 or a byte-order mark?
Yes. .ps1 is a text format, so it can be generated as UTF-8, UTF-8 with a byte-order mark, UTF-16 LE or UTF-16 BE. The body is shortened before re-encoding so the finished file still lands on the exact size you asked for. Note that a UTF-16 file always has an even byte count.
How do I open or verify the PS1 file?
Parse without executing: [System.Management.Automation.Language.Parser]::ParseFile(...), or lint with PSScriptAnalyzer.