Comments (3)
I did not like using the non-string typed parameters. This below might be the best of both worlds. I use a trap because the methods called will fail if the time zone or culture is invalid. The validation will still display the error.
# Timezone (default: your local time zone)
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateScript({
trap [System.TimeZoneNotFoundException] {$false}
[System.TimeZoneInfo]::FindSystemTimeZoneById($_) -ne $null
})]
[string]
$TimeZone = [System.TimeZoneInfo]::Local.Id,
# Specifies the system input locale and the keyboard layout (default: en-US)
[Parameter(ValueFromPipelineByPropertyName)]
[ValidateScript({
trap [System.Globalization.CultureNotFoundException] {$false}
[System.Globalization.CultureInfo]::GetCultureInfo($_) -ne $null
})]
[string]
$InputLocale = 'en-US',
BTW, The lists can be generated.
[System.TimeZoneInfo]::GetSystemTimeZones().Id
[System.Globalization.CultureInfo]::GetCultures([System.Globalization.CultureTypes]::AllCultures).Name
from windowsimagetools.
The original reason for having the parameter sets was so it has tab completion.
Based on your idea I found a way to use still have tab completion and not have to type them all out.
from windowsimagetools.
Looks like it's working.
from windowsimagetools.
Related Issues (15)
- Help file incorrect HOT 1
- Join account domin not always domain Joined HOT 1
- 64K ALU Support? HOT 2
- Reuse Use Case - Separate Unattended HOT 3
- Create recovery patition as first partition
- Error at Set-Disk/VHD Partition Command in Convert-Wim2VHD HOT 1
- Set-DiskPartition does not report a useable error
- Wrong parameter in Set-DiskPartition.ps1 HOT 1
- Windows Server 2019 HOT 1
- $DiskLayout -eq 'BIOS' HOT 1
- Invalid module file HOT 2
- Reduce the New-DataVHD minimum size requirement HOT 3
- Module export for New-Unattended does not match function New-UnattendXml HOT 1
- New-Unattend DomainAccount Support? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windowsimagetools.