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
# | |
# ConstantPingToArc.ps1 | |
# | |
##This script purpose is to ping Arc console to monitor for network dropouts. | |
#Location for the log file | |
$testPath = Test-Path "C:\ping logs\" | |
#Manual on/off switch, if $onOff = $true means the loop is on, $false = its off. | |
$onOff = $true |
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
#Database name you want to get all mailboxes from | |
#Add * on the end for a wildcard | |
$database = "PER*" | |
#Output File name | |
$Filename = "Export.csv" | |
#Where you want to export the file | |
$Path = "C:\" |
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
# | |
# RebootTime.ps1 | |
# | |
Set-ExecutionPolicy -ExecutionPolicy Bypass | |
Get-WmiObject win32_operatingsystem | select csname, @{LABEL='LastBootUpTime';EXPRESSION={$_.ConverttoDateTime($_.lastbootuptime)}} |
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
<# | |
.Synopsis | |
Gets all users associated within a AD Group | |
.DESCRIPTION | |
Gets all users associated within a AD Group | |
.EXAMPLE | |
get-ADUserfromGroup [adgroupname] | |
.EXAMPLE | |
Another example of how to use this cmdlet | |
#> |
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
#Enter top level location here | |
$filelocation = "" | |
#Remove the -whatif at the end if you want it to actually remove the folders | |
(gci $filelocation -r | ? {$_.PSIsContainer -eq $True}) | ?{$_.GetFileSystemInfos().Count -eq 0} | Remove-Item -verbose -whatif |
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
#which exchange server | |
$server = "" | |
Get-Mailbox -Filter{(HiddenFromAddressListsEnabled -eq $false) -AND (UserAccountControl -eq "AccountDisabled, NormalAccount")} | |
| where {$_.servername -like "$server"} | set-mailbox -HiddenFromAddressListsEnabled $True | |
##Must run in exchange console## |
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
#specify the content here | |
$content = gc "content path here" | |
#Have a list of what the files will be called specified here | |
$port = import-csv "list path here" | |
#loops through the list, creating pages and adding the content | |
foreach($i in $port){ | |
Add-Content "C:\eco\export\$($i.Title)" $content -force | |
} |
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
#Where do you want the file to be exported to | |
$Export = "C:\" | |
#What OU Do you want to target | |
$OU=@("OU=PS,DC=ps,DC=internal","OU=TCASP,DC=ps,DC=internal") | |
#loop through the array of OUs and find all the computers. Selects the: Name, Operatingsystem, lastlogondate, modified, Created and Canonicalname and exports to CSV | |
$OU | foreach { get-adcomputer -Filter * -SearchBase $_ -Properties * | |
| select -Property Name, Operatingsystem, lastlogondate, modified, Created, Canonicalname} | export-csv $Export |
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
$users = get-aduser -filter * -SearchBase "OU=ToBeArchived,OU=Users,OU=PS,DC=ps,DC=internal" | select -Property samaccountname | |
$groups = get-aduser -filter * -SearchBase "OU=ToBeArchived,OU=Users,OU=PS,DC=ps,DC=internal" -Properties memberof | select -Property memberof -ExpandProperty memberof | |
foreach($user in $users){foreach($group in $groups){Remove-ADGroupMember $group -Members $user.samaccountname -whatif; $user}} |
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
#Run this first - It will ask you to login (microsoft account) | |
Connect-MsolService | |
#This gets the domain | |
$domain = Get-MsolPartnerContract -DomainName #change me to the domain name e.g. someone.onmicrosoft.com | |
#this gets the users in the group | |
$groups = @(Get-MsolGroup -TenantId $domain.TenantId) | |
#This goes through the groups and lists the users. | |
foreach($element in $groups){$element.DisplayName; Get-MsolGroupMember -TenantId $domain.TenantId -GroupObjectId $element.ObjectID} |
OlderNewer