Saturday, 4 November 2017

powershell & chocolatey

1. set web proxy

$reg = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
Set-ItemProperty -Path $reg -Name ProxyServer -Value "proxy.example.org:8080"
Set-ItemProperty -Path $reg -Name ProxyEnable -Value 1


2. install chocolatey
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))


3. install and uninstall app
  • cinst jdk8 -y
  • clist -l
  • cuninst packagename

4. execute native command
  • iex

5. execute executable
  • &

6. log console output to file

  • Start-Transcript -path $LogFile -append
  • Stop-Transcript

7. task security

  • run only when user is logged on
  • run whether user is logged on or not (does not work for UI interactive program like autoit)

8. rdp session



ref
1. set window web proxy with powershell
2. powerscript to install dev machine
3. powershell run executables
4. redirect output to file
5. task security when using schtasks
6. rdp session timeout configuration
7. inactive logon windows 2012

No comments:

Post a Comment