Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

unable to specify an array (range of numbers) as integer

$
0
0

hi friends

where am i wrong here?

PS C:\>1..10 -is [int]

 false

 

[int]$array = 1..10

Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32".

 

$array = 1..10

$array -as [int]

$array -is [int]

false

 

my goal is to use that array in the following command:

Get-random $array -count 3

 

 

[int]

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles