a
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
# List approved and decline updates, including details such as the computer | |
# group(s) for which they have been approved/declined and the date/time on which | |
# the action was taken. | |
# NB: If an administrator has neither approve or declined an update then it is | |
# implcitly classified as 'NotApproved'. However, it would appear that the | |
# 'GetUpdateApprovals' method (used below) does NOT retrieve such updates. | |
$serverName = "TestServer" | |
$portnumber = 8530 |
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
$ExpectedValue = "Ping statistics for 127.0.0.1:" | |
$Binary = "ping.exe" | |
$Arguments = "127.0.0.1 -n 10" | |
$ProcessStartInfo = New-Object System.Diagnostics.ProcessStartInfo | |
$ProcessStartInfo.UseShellExecute = $false | |
$ProcessStartInfo.RedirectStandardError = $true | |
$ProcessStartInfo.RedirectStandardInput = $true | |
$ProcessStartInfo.RedirectStandardOutput = $true | |
$ProcessStartInfo.FileName = $Binary |
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
Grant user 'Log on as batch job' rights | |
======================================= | |
NTRIGHTS.EXE: | |
* NTRIGHTS.exe is part of the Windows Server 2003 Resource Kit. | |
Once installed, NTRIGHTS.exe resides in 'C:\Program Files (x86)\Windows Resource Kits\Tools\'. | |
* I have tested it on Windows Server 2012 R2 x64, works fine. | |
* [ ] Run the following command: ntrights -u <USERNAME> +r SeBatchLogonRight | |
SECPOL.MSC: |
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
$sRawOutput -replace ':\\: =>', '=' |
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
# -*- coding:utf-8 -*- | |
# Bot2Human | |
# | |
# Replaces messages from bots to humans | |
# typically used in channels that are connected with other IMs using bots | |
# | |
# For example, if a bot send messages from XMPP is like `[nick] content`, | |
# weechat would show `bot | [nick] content` which looks bad; this script | |
# make weecaht display `nick | content` so that the messages looks like | |
# normal IRC message |
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
$TriggerParams = @{ | |
Daily = $true | |
At = '12am' | |
ErrorAction = 'Stop' | |
} | |
$SettingsParams = @{ | |
ExecutionTimeLimit = [TimeSpan]::FromHours(2) | |
ErrorAction = 'Stop' | |
} | |
$TaskParams = @{ |
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
# foreach pipeline without format-table | |
$col = 1,2,3 | |
$col | foreach { | |
write-host "Doing thing $($_)..." | |
get-childitem C:\windows\regedit.exe | |
} | |
# Output: |
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
On the server: | |
- Create a .ssh directory in the user's profile. | |
- Create a file named "authorized_keys" in the .ssh directory. | |
- Grant permissions on the directory - only the owner can read, write, or open the directory. | |
- Grant permissions on the file - owner can read and write. | |
On the client: | |
- Generate a key pair using PuTTY Key Generator (puttygen.exe). | |
- Right-click in the text field labelled Public key for pasting into | |
OpenSSH authorized_keys file and choose 'Select All'. |
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
$SourceRoot = "C:\foo" | |
$DestRoot = "C:\blah" | |
$SourceContent = Get-ChildItem $SourceRoot -Recurse | |
$SourceContent | foreach { | |
If ($_.PSIsContainer) {$NewItemType = "Directory"} | |
Else {$NewItemType = "File"} | |
$newitem = ($_.fullname).replace($SourceRoot, $DestRoot) | |
New-Item $newitem -ItemType $NewItemType -force | |
} |