Skip to content

Instantly share code, notes, and snippets.

@win2000b
win2000b / ExportADProxy.ps1
Created September 23, 2016 14:10
Export AD Users and Proxy Addresses
Get-ADUser -Filter * -Properties proxyaddresses | Select-Object Name, @{L = "ProxyAddresses"; E = { $_.ProxyAddresses -join ";"}} | Export-Csv -Path c:\temp\proxyaddresses.csv -NoTypeInformation
@win2000b
win2000b / EnableLitigationAndAuditing.ps1
Last active April 27, 2017 14:27
Enabled Litigation Hold and Auditing for all mailboxes where it doesn't exist.
#To generate the encrypted password file, login as the user in which the task will run under.
$credential = Get-Credential schedule365@company.co.uk
$credential.Password | ConvertFrom-SecureString | Set-Content "Schedule365.txt"
#365 Admin Account to be used
$admin = "schedule365@company.co.uk"
#Get Encrypted Password File
$password = Get-Content "C:\Scripts\Schedule365.txt" | ConvertTo-SecureString
@win2000b
win2000b / Grant Execute
Created October 18, 2016 15:05
Creates a new role in SQL and grants the execute rights on it. So it can run SSIS packages
/* CREATE A NEW ROLE */
CREATE ROLE db_executor
/* GRANT EXECUTE TO THE ROLE */
GRANT EXECUTE TO db_executor
@win2000b
win2000b / AddRemoteAppUser.ps1
Created December 6, 2016 12:26
Add Azure Remoteapp user to a collection
Add-AzureRemoteAppUser -CollectionName "Contoso" -Type OrgId -UserUpn PattiFuller@contoso.com
@win2000b
win2000b / ConnectToExchange.ps1
Last active June 1, 2017 08:44
Connect to Exchange Online
$Credential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $Credential -Authentication Basic -AllowRedirection
Import-PSSession $Session
@win2000b
win2000b / GetBitlockerSchema.ps1
Last active December 15, 2016 12:08
Finds out if Bitlocker Schema Extensions are in place
Get-ADObject -SearchBase ((GET-ADRootDSE).SchemaNamingContext) -Filter {Name -like "ms-FVE-*"}
@win2000b
win2000b / AddBitlockerVCE.vbs
Created December 15, 2016 10:30
Allows Machines to Store Bitlocker keys in AD
'===============================================================================
'
' This script demonstrates the addition of an Access Control Entry (ACE)
' to allow computers to write Trusted Platform Module (TPM)
' recovery information to Active Directory.
'
' This script creates a SELF ACE on the top-level domain object, and
' assumes that inheritance of ACL's from the top-level domain object to
' down-level computer objects are enabled.
'
@win2000b
win2000b / AddPortsToLoadBalancer.ps1
Created January 3, 2017 09:46
Add Port Range to Azure Load Balancer
$VM = Get-AzureVM -ServiceName "cloudservicename" -Name "VirtualMachineName"
for ($Port = 6000; $Port -le 6100; $Port++)
{
$VM = $VM | Add-AzureEndpoint -Name "FTP-Pasv-$Port" -Protocol 'TCP' -LocalPort $Port -PublicPort $Port
}
$VM | Update-AzureVM
@win2000b
win2000b / EnableModernAuthExchangeOnline.ps1
Last active January 4, 2017 14:03
Enables Modern Authentication with Exchange Online in 365
# To Enable Modern Auth
Set-OrganizationConfig -OAuth2ClientProfileEnabled:$true
# Verify that the change was successful by running the following:
Get-OrganizationConfig | ft name, *OAuth*
@win2000b
win2000b / ConnectToSkypeOnline.ps1
Last active April 19, 2017 16:09
Connect to Skype Online via PowerShell
# Download and install the Skype PowerShell Command http://go.microsoft.com/fwlink/?LinkId=294688
$credential = Get-Credential
$session = New-CsOnlineSession -Credential $credential
Import-PSSession $session