Skip to content

Instantly share code, notes, and snippets.

winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname="imani.maroc.home.buschick.org";CertificateThumbprint="39869B1E3C18761082B55C0791FC83797DA0D258"}'
#or
new-item -address * -force -path wsman:\localhost\listener -port 5986 -hostname 192.168.0.213 -transport https -certificatethumbprint 47DBC1FF268E4B4B9AA76B7471127B13C679DC24
@adamedx
adamedx / getjob.ps1
Created March 13, 2015 17:05
Job object in Windows example
if ($args.length -gt 0)
{
$mypid = $args[0]
}
else
{
$mypid = $pid
}
@adamedx
adamedx / msiprop.rb
Created January 14, 2014 19:07
Quick script to read a property from a Windows Installer file
#!/usr/bin/env ruby
current_dir = File.dirname(__FILE__)
require 'ffi'
module Win32
extend FFI::Library
ffi_lib 'msi'
attach_function :msi_open_package_ex,
@adamedx
adamedx / gist:6471019
Last active December 22, 2015 12:18
Remote_file fails on Windows when source attribute uses file scheme and atomic_update is set to default value of true on Chef 11.6.hotfix.1

By default in Chef 11.6, remote_file uses the atomic update strategy for updating files. On Windows, this results in remote_file resources failing with a source url using the "file:" scheme failing with access denied -- here is an example recipe:

remote_file "#{ENV['HOME']}/non_atomic_works.txt" do
  atomic_update false
  source "file://#{ENV['SystemDrive']}/windows/system.ini"
 end

remote_file "#{ENV['HOME']}/atomic_fails.txt" do
  source "file://#{ENV['SystemDrive']}/windows/system.ini"

end