Tuesday, January 26, 2016

PowerShell

AUTOMATING WITH JENKINS AND POWERSHELL ON WINDOWS

PowerShell IDEs Alternative

Resources

  • http://powershell.org/wp/
  • http://blogs.technet.com/b/heyscriptingguy
  • http://github.com/OneGet/oneget                3:00
    • Get-Command -Module PackageManagement | Sort-Object Noun, Verb
      • Find-Package | Out-GridView
    • ..

Tools

Comlets

Get-Command

# Search command
Get-Command -verb "get"
Get-Command -noun "service"

# Get-Help
Get-Help Get-Command
Get-Help -examples
Get-Help -detailed
Get-Help -full
Get-Help -online
Get-Command -?


makecert -n "CN=PowerShell Local Certificate Root" -a sha1 -eku 1.3.6.1.5.5.7.3.3 -r -sv root.pvk root.cer -ss Root -sr localMachine
make cert -pe -n "CN=PowerShell User" -ss MY -a sha1 -eku 1.3.6.1.5.5.7.3.3 -iv root.pvk -ic root.cer


# With RemoteSigned we can run our script
Set-Location 'D:\GitHub\beginning-PS-Dev\pss\'
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser 
. '.\6-do-something.ps1'

# With Unrestricted we can run anything
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser 
$doSomething = 'D:\GitHub\beginning-PS-Dev\pss\6-do-something.ps1'
. $doSomething

Get-ExecutionPolicy -List

Set-ExecutionPolicy -ExecutionPolicy Unrestricted
Enable-PSRemoting -Force
Set-Item wsman:\localhost\client\trustedhosts *
Restart-Service WinRM

Test-WSMan 192.168.140.250

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home