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
[cmdletbinding()] | |
Param( | |
$UnzipSearch = '(?s)(<([^>]+)>.*?</\2>)', | |
$UnzipReplace = "`n`$1`n", | |
$SnipSnipSearch = '(?m)(?<=^<.*)`n', | |
$SnipSnipReplace = '', | |
$RezipSearch = "`n", | |
$RezipReplace = '' | |
) |
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
# Usage: | |
# Edit default OU path if you aren't going to specify it on the command line (you normally won't). | |
# (If pasted into a script file, dot source it to bring functions into current scope) | |
# Connect to your EXO instance: | |
# & "C:\Program Files\Internet Explorer\iexplore.exe" https://cmdletpswmodule.blob.core.windows.net/exopsmodule/Microsoft.Online.CSE.PSModule.Client.application | |
# To list eligible groups: | |
# Get-AadMigrationEligibleDistributionGroups | |
# To Select some group\groups: |
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 Enable-RDPAccess ($TargetComputer) | |
{ | |
Invoke-Command -ComputerName $TargetComputer { | |
set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server'-name "fDenyTSConnections" -Value 0 | |
set-ItemProperty -Path 'HKLM:\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp' -name "UserAuthentication" -Value 1 | |
} | |
} |
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
$filesperfolder = 55 | |
$sourcePath = "C:\Source\SPLITFILELOCATION\" | |
$destPath = "C:\Source\Test Sample\" | |
$i = 0; | |
$FolderName = "Dr. Bob" | |
$folderNum = 1; | |
$CurrentFolderSize = 0 | |
New-Item -Path ($destPath + $FolderName + $folderNum) -Type Directory -Force | |
Get-ChildItem "$sourcePath\*.pdf " | % { | |
if (($CurrentFolderSize + $_.Length) -gt 800MB) { |
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
mkdir 1; mkdir 2; | |
new-item 1\FILENAME.txt; new-item 2\FILENAME.txt; | |
ls *\FILENAME.txt | Select -Exp Fullname ; | |
ls *\FILENAME.txt | sort -desc Fullname | Select -Exp Fullname ; | |
ls *\FILENAME.txt | sort -desc fullname | Sort Name | Select -Exp Fullname | |
# You can do this without the Select -Exp Fullname, but this is easier to see what its doing. | |
Another test: |
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
class Computer{ | |
[string] GetComputerName() | |
{ | |
$raw_name = hostname | |
$name = $raw_name.trim("") | |
return $name.trim("") | |
} | |
[string] GetIPAddress() | |
{ | |
$IpList = (Get-NetIPAddress).IPv4Address |
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
for ($i = 0; $i -gt 5; $++) | |
{ | |
if ((Get-Service -Computername $s -name Tomcat7).Status -eq "Running") | |
{ | |
break | |
} | |
else | |
{ | |
Start-Service -Computername $s -name Tomcat7 | |
} |
NewerOlder