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
//Notes: | |
//Requires the MMBot.Powershell nuget package | |
//Output objects must either support a ToString method or be a string to display properly | |
//It is recommended to use the PowershellModule script instead of this one to control what is executed | |
using MMBot.Powershell; | |
var robot = Require<Robot>(); | |
robot.Respond(@"(ps|powershell) (.*)", msg => |
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
$logs = 'c:\windows\system32\ccm\logs\smstslog' | |
if (-not (test-path $logs)) | |
{ | |
exit 0 | |
} | |
$tsenv = new-object -comobject Microsoft.SMS.TSEnvironment | |
$computer = "" | |
if ($tsenv -ne $null) | |
{ |
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
#you can use this as a script or just run these three commands one at a time | |
import-module bitstransfer | |
#kick off the transfer | |
start-bitstransfer -source "large file" -destination "folder" -asyncronous -displayname MyTransfer | |
#monitor transfer and restart if failed | |
1..1000|% {sleep (60); get-bitstransfer -name MyTransfer |% {if ($_.jobstate -eq "Transferring") {write-host $($_.bytestransfered / $_.bytestotal)} elseif ($_.jobstate -like "error") {resume-bitstransfer $_; "resuming after error"} elseif ($_.jobstate -like "Transferred") {complete-bitstransfer $_; exit}} |
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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" | |
$ToTest = { | |
"AAAAAAA" | |
"AAAAAAAA" | |
"AAAAAAAAA" | |
"AAAAAAAAAA" | |
"AAAAAAAAAAA" | |
"AAAAAAAAAAAA" | |
"AAAAAAAAAAAAA" |
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
Import-Module BitsTransfer | |
$s = "C:\Source" | |
$d = "D:\Destination" | |
xcopy.exe /T /E $s $d | |
ls $s -Recurse |? {! $_.PSIsContainer} |% { | |
$e = $_.FullName.Remove(0, $s.Length + 1) | |
start-bitstransfer $($_.FullName) $d\$e | |
} |
NewerOlder