This file contains hidden or 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
Function UserSearch | |
{ | |
Param ([string]$AccountName) | |
#Check if there's a realm specified | |
if ($AccountName.Split("\").count -gt 1) | |
{ | |
if ($AccountName.Split("\")[0] -eq $env:COMPUTERNAME) | |
{ | |
$IsLocalAccount = $true | |
} |
This file contains hidden or 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
#!powershell | |
# This file is part of Ansible | |
# | |
# Copyright 2015, Phil Schwartz <[email protected]> | |
# | |
# Ansible is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
This file contains hidden or 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
- name: Wait for windows reboot | |
# when: pending_reboot_output.pending_reboot == true | |
shell: 'if [[ -n $(curl -s -f -k --header "Content-Type: application/soap+xml;charset=UTF-8" --header "WSMANIDENTIFY: unauthenticated" https://thansiblewin01.ansib.le:5986/wsman --data "<s:Envelope xmlns:s=http://www.w3.org/2003/05/soap-envelope xmlns:wsmid=http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd><s:Header/><s:Body><wsmid:Identify/></s:Body></s:Envelope>" || true) ]]; then curl -s -f -k --header "Content-Type: application/soap+xml;charset=UTF-8" --header "WSMANIDENTIFY: unauthenticated" https://thansiblewin01.ansib.le:5986/wsman --data "<s:Envelope xmlns:s=http://www.w3.org/2003/05/soap-envelope xmlns:wsmid=http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd><s:Header/><s:Body><wsmid:Identify/></s:Body></s:Envelope>" || true ;else echo "nothing returned" ;fi' | |
register: result2 | |
until: result2.stdout.find("http://www.w3.org/2003/05/soap-envelope") | |
retries: 10 | |
delay: 10 | |
delegate_t |
This file contains hidden or 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
http://care.dlservice.microsoft.com/dl/download/7/3/C/73C250BE-67C4-440B-A69B-D0E8EE77F01C/10514.0.150808-1529.TH2_RELEASE_SERVER_OEMRET_X64FRE_EN-US.ISO |
This file contains hidden or 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
#Release when less than 4 moves are in progress | |
Function WaitForMoves | |
{ | |
Do { | |
$moves = Get-moverequest | Get-moverequeststatistics | where {$_.StatusDetail -ne "COmpleted"} | |
if (($moves.count) -gt 3) | |
{ | |
$movescount = $moves.count | |
Write-Progress -Activity "Moving $movescount" -Status "Moving $movescount" -PercentComplete 100 | |
Start-sleep -seconds 10 |
This file contains hidden or 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
Set-StrictMode -Version 2 | |
$params = "" | Select Firstname, Lastname, ensure | |
$params.Lastname = "Hindenes" | |
$params.Ensure = "present" | |
$returnobj = "" | |
. "D:\trond.hindenes\Documents\Scripts\Ansible\fork\trondhindenes\ansible\lib\ansible\module_utils\powershell.ps1" | |
#simple - should succeed | |
Get-AnsibleParam -obj $params -name Firstname | |
#Use alias |
This file contains hidden or 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
function Unzip-File { | |
[CmdletBinding()] | |
param ( | |
[Parameter(Mandatory=$true, | |
ValueFromPipeline=$true)] | |
[ValidateScript({ | |
If ((Test-Path -Path $_ -PathType Leaf) -and ($_ -like "*.zip")) { | |
$true | |
} |
This file contains hidden or 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
Function Exit-Json($obj) | |
{ | |
# If the provided $obj is undefined, define one to be nice | |
If (-not $obj.GetType) | |
{ | |
$obj = New-Object psobject | |
} | |
echo $obj | ConvertTo-Json -Compress -Depth 99 | |
Exit |
This file contains hidden or 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
#!powershell | |
# This file is part of Ansible. | |
# | |
# Copyright 2015, Trond Hindenes <[email protected]> | |
# | |
# Ansible is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |
This file contains hidden or 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
#!powershell | |
# This file is part of Ansible. | |
# | |
# Copyright 2015, Trond Hindenes <[email protected]> | |
# | |
# Ansible is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# |