Skip to content

Instantly share code, notes, and snippets.

View normansolutions's full-sized avatar

Clive Norman normansolutions

View GitHub Profile
@normansolutions
normansolutions / proxy.pac
Created March 28, 2020 09:19
HZG Proxy Pac File
function FindProxyForURL(url, host) {
// Your proxy server name and port
var proxy_yes = "PROXY proxylb.schoolsbroadband.net:31702";
var proxy_no = "DIRECT";
if (isInNet(myIpAddress(), "10.3.0.0", "255.255.0.0")) return proxy_no;
// DEFAULT RULE: All other traffic, send direct
return proxy_yes;
}
function FindProxyForURLEx(url, host) {
Import-Module ActiveDirectory
$ou = "OU=Office Computers,Dc=CompanyName,Dc=Net"
Get-ADComputer -Filter * -SearchBase $ou |
ForEach-Object {
Restart-Computer -ComputerName $_.name -force
}
# If you wish to eliminate specific machines from this restart - no problem, you can add a "where" clause using a wildcard to either target an individual or complete OU.
SELECT p.txtschoolid,
p.txtsurname,
p.txtforename,
A.txtcontactssurname,
A.txtcontactsforename,
AL.tblpupilmanagementaddresslinkid,
A.tblpupilmanagementaddressesid,
( '(' + Isnull(A.txtrelationtype, '') ) + ')' + Char(13) + Char(10) +
( Isnull(A.txtcontactstitle, '') + ' '
+ Isnull(A.txtcontactsforename, '') + ' '
@normansolutions
normansolutions / ExcelSplitSiblingName.vba
Created September 17, 2017 12:59
Quick & Dirty Basic Excel Macro To Split Coma Separated Cells Into Columns (ideal for iSAMS sibling exports)
Private Sub Workbook_AfterSave(ByVal Success As Boolean)
'Crude error handling!
On Error Resume Next
siblingNameField = InputBox("Please enter the heading for the sibling names")
If siblingNameField = Empty Then Exit Sub
siblingYearField = InputBox("Please enter the heading for the sibling year group")
If siblingYearField = Empty Then Exit Sub
@normansolutions
normansolutions / ExcelMacroTranspose.vba
Last active July 8, 2016 08:17
Excel Macro To Transpose Copy Paste Looping Through Timetable Data
Sub Copy()
NextLine = 1
TeacherLine = 0
Period = 1
For i = 4 To 46
Worksheets("Main").Range("B" & i & ":BI" & i).Copy
Worksheets("Result").Range("B" & NextLine).PasteSpecial Transpose:=True
For T = 1 To 60
If Period > 60 Then Period = 1
####Create an Office 365 session connection
$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session
###Use this Powershell script to disable Clutter across all accounts
Get-Mailbox | Set-Clutter -Enable $true
###Use this PowerShell script to disable Clutter for an individual (in this example "PTest")
@using System.Configuration;
@{
string ComplexURLFromWebConfig = ConfigurationManager.AppSettings["ComplexURLQueryString"].ToString().Trim();
@* QueryString sent from url *@
string QueryStringComplexURL = (Request.QueryString["ComplexURLQueryString"] ?? "").ToString().Trim();
<appSettings>
<add key="ComplexURLQueryString" value="hhqsdc332323vxzcjsdffbfsh12sdfdfgdfgdfgwerktyykfdhgdhjsdfsdfasdffdfww"/>
</appSettings>
@{
String cookieQueryString = Request.QueryString["cookieSetter"];
switch (cookieQueryString)
{
@* QueryString "remove" - This deletes the cookie from the device *@
case "remove":
Response.Cookies["NSSecureMethodCookie"].Expires = DateTime.Now.AddYears(-30);
break;
@normansolutions
normansolutions / AccountLockOutNotification.ps1
Last active August 29, 2015 14:23
PowerShell Script To Notify When User Account Has Been Locked Out
########################################################################
# Please Configure the following variables - $smtpServer and $from
# Leave the $event and $body variables as they are
$smtpServer="YOUR SMTP SERVER"
$from = "SET FROM EMAIL ADDRESS"
$event = Get-EventLog -LogName Security -InstanceId 4740 -Newest 1
$body = $event.Message + "`r`n`t" + $event.TimeGenerated
########################################################################
Send-Mailmessage -smtpServer $smtpServer -from $from -to $from -subject "Account Lockout" -body $body -priority High