File: powershell.actual

package info (click to toggle)
golang-github-alecthomas-chroma-v2 2.5.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 7,980 kB
  • sloc: xml: 33,149; python: 589; javascript: 357; makefile: 36; sh: 36
file content (82 lines) | stat: -rw-r--r-- 1,707 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
Get-ChildItem -Recurse -Force -ErrorAction SilentlyContinue -Name -Path  C:\ *.txt

#Requires -modules ModuleName
#Requires -Assembly "System.Management.Automation, Version=1.0.0.0,Culture=neutral, PublicKeyToken=31bf3856ad364e35"
#Requires -Modules @{ ModuleName="ModuleName"; ModuleVersion="1.2.3" }
#Requires -PSSnapin SnapinName -version 1.2
#Requires -RunAsAdministrator
#Requires -WrongParameter ParamValue

<#
    Multiline comment
    .DESCRIPTION
    This is a description
#>

# this is a comment

function test { }
class test {}
class test2 : test { }

@"
double quoted $MyVar here string
"@

@"
double quoted ${MyVar} here string
"@

@"
double quoted $(Get-Stuff -Param1 $MyVar ) here string
"@

@'
single quoted $(Get-Stuff -Param1 $MyVar ) here string
'@

'Single quoted string $MyVar'
"Double quoted string $MyVar"
"Double quoted string $(Get-Stuff -Param1 $MyVar )"
"Double quoted string ${var}"

$HashTable =  @{
    'Something' = $Var
    'Else'      = 'string'
}

$myvar.'property name in string'
[string]::UseMethod(12.34)
15gb
@{}
@()
$()
$test = C:\test
$MyVar = Get-Something -SwitchParam:$false
$MyVar.property
$MyVar.property.property.somemethod()
$global:test
$null
$true
$false

Configuration ConfigurationName
{
    Import-DSCResource -ModuleName MyModule
}

function Get-Stuff {
    [CmdletBinding(SupportsShouldProcess=$true)]
    param (
        [Parameter(Mandatory=$true, DontShow)]
        [ValidateNotNullOrEmpty()]
        [ValidateScript({ $_ -ne $null })]
        [ValidateRange(0, [int]::MaxValue)]
        [Microsoft.PowerShell.Commands.WebRequestMethod]$Param1 = 'Get'
    )

    Process
    {
        if ($MyVar -lt (Get-Date).AddSeconds([int](12.4 / 2))) {}
    }
}