powershell - rip tutorial 2019-01-18آ  dsc 177 dsc 178 62: 179 179 179 examples 179 179 179 179...

Download PowerShell - RIP Tutorial 2019-01-18آ  DSC 177 DSC 178 62: 179 179 179 Examples 179 179 179 179 179

Post on 19-Jul-2020

4 views

Category:

Documents

0 download

Embed Size (px)

TRANSCRIPT

  • PowerShell

    #powershell

  • 1

    1: PowerShell 2

    2

    2

    Examples 2

    2

    Windows 3

    3

    3

    4

    - PowerShell 5

    6

    .NET 6

    7

    2: ActiveDirectory 9

    9

    9

    Examples 9

    9

    9

    9

    10

    10

    3: Amazon WebAWSSimple Storage ServiceS3 12

    12

    12

    Examples 12

    S3 12

    S3 12

    S3 13

    4: Amazon WebAWS 14

  • 14

    Examples 14

    AWS 14

    AWS 14

    5: CSV 16

    Examples 16

    Import-Csv 16

    CSV 16

    6: DSC 18

    18

    18

    Examples 18

    DSC 18

    KeyDSC 18

    DSC 19

    DSC 19

    7: ISE 21

    21

    Examples 21

    21

    8: MongoDB 22

    22

    Examples 22

    PowerShellC1.7MongoDB 22

    Powershell3 22

    9: Pester 24

    24

    Examples 24

    Pester 24

    10: PowerShell.exe 26

    26

  • Examples 27

    27

    -Command 27

    -Command {scriptblock} 27

    - - 27

    28

    28

    28

    11: PowerShell 29

    29

    Examples 29

    29

    29

    31

    31

    31

    32

    12: Powershellv2.0Artifactory 33

    33

    Examples 33

    artifcatPowershell 33

    13: PowershellIPv4v6 34

    34

    Examples 34

    IP 34

    14: PowerShellTCP 36

    Examples 36

    TCP 36

    TCP Sender 36

    15: PowerShell "" 38

    38

  • Examples 38

    38

    38

    16: PowershellGUI 40

    Examples 40

    Get-ServiceWPF GUI 40

    17: PowerShellSQL 42

    42

    42

    42

    Examples 44

    SQLExample 44

    SQLQuery 44

    18: PowerShell 46

    46

    46

    Examples 46

    46

    47

    19: PowerShell 49

    Examples 49

    49

    20: PowerShell 51

    51

    Examples 51

    51

    51

    51

    CmdLet 52

    53

    53

    arry 53

  • 53

    21: PowerShell 55

    55

    55

    Examples 55

    55

    55

    56

    56

    57

    22: PowerShell 59

    59

    59

    59

    Examples 59

    59

    60

    60

    23: Powershell 62

    62

    Examples 63

    63

    24: Powershell 64

    64

    Examples 64

    64

    64

    65

    PowerShell 65

    66

    66

    25: Powershell 67

  • 67

    Examples 67

    PowerShell Remoting 67

    67

    67

    PowerShell 68

    68

    69

    69

    PSSessions 70

    26: PowerShell 72

    72

    72

    Examples 72

    72

    72

    73

    73

    27: PowerShell 74

    74

    Examples 74

    74

    74

    75

    75

    77

    ValidateSet 77

    ValidateRange 78

    ValidatePattern 78

    ValidateLength 78

    ValidateCount 78

  • ValidateScript 78

    28: Psake 80

    80

    80

    Examples 80

    80

    FormatTaskName 80

    81

    ContinueOnError 81

    29: PSScriptAnalyzer - PowerShell 82

    82

    82

    Examples 82

    82

    83

    83

    30: RESTful API 84

    84

    Examples 84

    Slack.comWebhook 84

    hipChat 84

    PowerShellREST 84

    PowerShellRESTPOST 85

    PowerShellREST 85

    31: SharePoint 86

    Examples 86

    SharePoint 86

    86

    86

    32: ShouldProcess 88

    88

    88

  • 88

    Examples 88

    -WhatIf-Confirm 88

    1ShouldProcess 88

    88

    33: URL/ 91

    91

    Examples 91

    91

    91

    `[uri] :: EscapeDataString` 92

    `[System.Web.HttpUtility] :: UrlEncode 93

    `[uri] :: UnescapeDataStringURL 93

    `[System.Web.HttpUtility] :: UrlDecodeURL 95

    34: WMICIM 98

    98

    CIMWMI 98

    98

    Examples 99

    99

    CIM 99

    99

    WQL 100

    101

    101

    101

    102

    103

    35: XML 104

    Examples 104

    XML 104

  • XmlWriterXML 106

    XMLDocumentXML 107

    107

    XML 107

    108

    109

    109

    111

    111

    36: 112

    112

    112

    112

    112

    Examples 113

    113

    ZIPCompress-Archive 113

    Expand-Archive 113

    37: 114

    114

    Examples 114

    114

    38: 115

    115

    Examples 116

    Get-Alias 116

    116

    39: 118

    118

    Examples 118

    118

  • 40: 120

    Examples 120

    120

    120

    120

    121

    1 121

    2Select-Object 121

    3pscustomobjectPSv3 + 122

    122

    123

    41: 125

    125

    Examples 125

    125

    125

    42: 126

    126

    Examples 126

    126

    128

    43: 131

    131

    131

    Examples 131

    131

    Regexswitch 131

    132

    switch 132

    switch 132

    CaseSensitiveSwitch 133

  • switch 133

    134

    134

    44: 135

    135

    135

    Examples 135

    PowerShell 135

    admininstrator 135

    45: 136

    136

    Examples 136

    PowerShell 136

    46: 137

    137

    137

    Examples 137

    137

    Splatting 137

    138

    138

    47: 140

    Examples 140

    140

    140

    140

    48: 141

    Examples 141

    .Net 141

    49: 142

    142

    Examples 142

  • PowerShell 142

    PowerShell 142

    142

    142

    142

    142

    50: 144

    144

    144

    Examples 144

    144

    144

    145

    145

    145

    146

    51: 147

    147

    Examples 147

    147

    147

    148

    52: 149

    149

    Examples 149

    $ PSScriptRoot 149

    $ Args 149

    $ PSItem 149

    $ 150

    $ 150

    53: 151

    151

  • Examples 151

    151

    Get-Help 151

    152

    152

    152

    152

    54: C| VB 153

    153

    153

    153

    153

    CSharp.NET 153

    Examples 153

    C 153

    VB.NET 154

    55: 156

    156

    Examples 156

    156

    156

    156

    157

    157

    158

    158

    56: 161

    161

    161

    161

    161

    161

  • Examples 162

    162

    162

    163

    ForEach-Object 163

    163

    164

    164

    ForEach 165

    165

    166

    57: 167

    167

    Examples 167

    ErrorAction 167

    -ErrorAction 167

    -ErrorAction 167

    -ErrorAction Inquire 168

    -ErrorAction 168

    -ErrorAction Stop 168

    -ErrorAction Suspend 168

    58: 170

    Examples 170

    170

    59: 171

    171

    171

    Examples 171

    Where-Object / where / 171

    / 172

    - / 173

  • Select-Object / select 173

    60: 175

    Examples 175

    175

    GUI 175

    175

    175

    61: 177

    Examples 177

    - WindowsFeature 177

    DSCmof 177

    psd1 177

    DSC 177

    DSC 178

    62: 179

    179

    179

    Examples 179

    179

    179

    179

    179

    180

    Here-string 180

    Here-string 180

    here-string 180

    181

    181

    + 181

    181

    181

  • 63: 183

    183

    Examples 183

    GUID 183

    .NET 183

    184

    64: 185

    185

    185

    Examples 185

    ifelseelse if 185

    185

    186

    65: 187

    187

    Examples 187

    187

    -Match 187

    188

    [RegEx] :: Match 189

    189

    -Replace 189

    [RegEx] :: Replace 190

    MatchEvalutor 190

    191

    191

    191

    [RegEx] :: Matches 192

    66: 194

    194

    Examples 194

  • 194

    194

    194

    194

    195

    196

    196

    67: 198

    Examples 198

    WindowsEnvPS 198

    $ env 198

    68: 199

    199

    Examples 199

    199

    199

    199

    Encrypter 200

    200

    200

    69: 202

    202

    202

    Examples 202

    202

    Set-ExecutionPolicy 203

    203

    203

    204

    205

    205

    70: 206

  • 206

    206

    Examples 206

    $ pid 206

    206

    $ null 206

    $ OFS 207

    $ _ / $ PSItem 207

    $ 207

    $ 208

    71: - 2 209

    209

    209

    Examples 209

    $ PSVersionTable 209

    72: 210

    210

    Examples 210

    KB - 210

    73: 211

    211

    Examples 211

    211

    212

    74: 214

    214

    214

    Examples 215

    Send-MailMessage 215

    Send-MailMessage 215

    SMTPClient - .txt 215

    217

  • You can share this PDF with anyone you feel could benefit from it, downloaded the latest version from: powershell

    It is an unofficial and free

Recommended

View more >