This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$a = (Get-WmiObject -ComputerName 'myserver.fqdn' -Namespace 'root\SMS\Site_XXX' -Class 'SMS_Driver' | ?{!(test-path $_.ContentSourcePath)}) | |
$a | %{$_.delete()} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | |
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class sethostname { | |
file { "/etc/hostname": | |
ensure => present, | |
owner => root, | |
group => root, | |
mode => 644, | |
content => "$::fqdn\n", | |
notify => Exec["set-hostname"], | |
} | |
exec { "set-hostname": |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param ( | |
[parameter( | |
Position = 0, | |
Mandatory = $true, | |
HelpMessage = 'This is the version number, such as "22.0". Valid version numbers can be found here: http://mzl.la/1c9hPmo' | |
)] | |
[string] $version, | |
[parameter( | |
Position = 1, | |
Mandatory = $false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[string] $Path = 'OU=foo,OU=test,DC=domain,DC=com' | |
try { | |
$ou_exists = [adsi]::Exists("LDAP://$Path") | |
} catch { | |
# If invalid format, error is thrown. | |
Throw("Supplied Path is invalid.`n$_") | |
} | |
if (-not $ou_exists) { | |
Throw('Supplied Path does not exist.') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[string] $RootOU = 'OU=test,DC=domain,DC=com' | |
[string] $Path = 'OU=foo' | |
try { | |
$ou_exists = [adsi]::Exists("LDAP://$Path") | |
} catch { | |
# If invalid format, error is thrown. | |
Write-Debug "Supplied Path is invalid.`n$_" | |
# It's probably the abbreviated version, so let's tack on the Root OU and confirm exists. | |
Write-Debug 'Placing Path in Root OU and re-verifying ...' | |
$Path = "$Path,$RootOU" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% for computer in 'TEST001','TEST002','TEST003' %} | |
{% if grains['nodename'] == computer %} | |
is_test_computer: True | |
{% else %} | |
is_test_computer: False | |
{% endif %} | |
{% else %} | |
is_test_computer: False | |
{% endfor %} |
OlderNewer