Skip to content

Instantly share code, notes, and snippets.

View VertigoRay's full-sized avatar
🔌
😏

Raymond Piller VertigoRay

🔌
😏
View GitHub Profile
@VertigoRay
VertigoRay / init.pp
Created July 17, 2013 20:39
Puppet - sethostname /etc/puppet/modules/common/sethostname/manifests/init.pp
class sethostname {
file { "/etc/hostname":
ensure => present,
owner => root,
group => root,
mode => 644,
content => "$::fqdn\n",
notify => Exec["set-hostname"],
}
exec { "set-hostname":
@VertigoRay
VertigoRay / Install.vbs
Last active February 23, 2017 06:00
This is a simple Install Wrapper. I use it with SCCM 2012 to allow STDOUT to be captured and sent to a log file, since STDOUT appears to be lost when deploying software as an SCCM 2012 Application.
Option Explicit
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' FIRST THINGS FIRST:
' Change this DeploymentTypeName to match the Deployment Type Name used in the Application.
' - It's just used to for the log file name.
' - For Uninstall action, append ".x" to name, such as: Application - Install.x
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim DeploymentTypeName
DeploymentTypeName = "CAS Remote - Install"
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@VertigoRay
VertigoRay / ProductsInstalled.vbs
Created March 5, 2013 16:49
This will Query WMI for all of the Programs installed with Windows Installer - which covers about 90% of our supported applications. Results are written to ProductsInstalled.txt in the Working Dir.
Option Explicit
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Usage:
' cscript.exe ProductsInstalled.vbs
'
' Description:
' This will Query WMI for all of the Programs installed with Windows Installer - which covers about 90%
' of our supported applications. Results are written to ProductsInstalled.txt in the Working Dir.
'
' Output Format:
@VertigoRay
VertigoRay / Uninstaller.vbs
Last active December 14, 2015 13:09
This will Query WMI for the specified program and uninstall it with Windows Installer - which covers about 90% of our supported applications. All actions are logged to %SystemRoot%\Logs\SCCM.
Option Explicit
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
' Usage:
' cscript.exe Uninstaller.vbs ApplicationName [LogFileName]
'
' Parameters:
' ApplicationName The Product Name of the Program you want to Uninstall. This will
' remove all instances of the program, so be as specific as you want.
' - Example: "Adobe" would remove all Adobe products (anything with Adobe in the Name)
' - Example: "Adobe Reader" will remove all versions of Adobe Reader.
@VertigoRay
VertigoRay / ServiceRecovery.cmd
Last active December 14, 2015 12:29
Used with Win Service Recovery to recover servers that Exit Unclean. Will log to file and retry n times. Implementation Screenshots: http://imgur.com/a/dmqq8
@echo off
setlocal
SET /A RETRYMAX=10
SET LOG=%SystemRoot%\Logs\ServiceRecovery.log
FOR /F "tokens=2*" %%a in ('sc query %1 ^| findstr STATE') do SET STATUS=%%b
SET STATUS=%STATUS: =%
IF ERRORLEVEL 1 goto _errawr
IF "%STATUS%"=="4RUNNING" goto:eof
@VertigoRay
VertigoRay / SCCM2012-DeleteInvalideDrivers.ps1
Last active December 14, 2015 09:50
SCCM 2012 - Driver Importing. This code to deletes drivers with bad sources.
$a = (Get-WmiObject -ComputerName 'myserver.fqdn' -Namespace 'root\SMS\Site_XXX' -Class 'SMS_Driver' | ?{!(test-path $_.ContentSourcePath)})
$a | %{$_.delete()}