Skip to content

Instantly share code, notes, and snippets.

View normansolutions's full-sized avatar

Clive Norman normansolutions

View GitHub Profile
@normansolutions
normansolutions / DisableRDPonAD.ps1
Last active August 29, 2015 13:56
For use on blog post: http://www.normansolutions.co.uk/post/PowerShell to secure AD users RDP access
Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction SilentlyContinue
Get-QADUser * -OrganizationalUnit "ou=Your Sub-OU,ou=Your OU,dc=Your LDAP,dc=Your LDAP" |
?{$_.TsAllowLogon -ne $true} |
Set-QADUser -TsAllowLogon $true
C:\SCHEDULE\SBGroups\CreateADGroups.exe "DC=St-Stephens, DC=Local" "OU=SBGroups" "OU=Students, OU=St Stephens Users" "Art|Photo" "UCAS"
namespace CreateADGroups
{
class Program
{
static void Main(string[] args)
{
string activeDirPath = args[0];
string activeDirOU = args[1];
string usersLocation = args[2];
string filterIn = args[3];
@normansolutions
normansolutions / ListUsersWhoHaveAccess.ps1
Created January 13, 2014 12:11
PowerShell script to display all users to have access to other mailboxes in Exchange. Thanks to: http://exchangeserverpro.com/list-users-access-exchange-mailboxes/
Get-Mailbox | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_.IsInherited -eq $false} | Select Identity,User,@{Name='Access Rights';Expression={[string]::join(', ', $_.AccessRights)}} | Export-Csv -NoTypeInformation mailboxpermissions.csv
<ul class="nav navbar-nav">
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Recent Articles <b class="caret"></b></a>
<ul class="dropdown-menu">
@foreach (var postTitle in Storage.GetAllPosts().Where(pub => pub.IsPublished == true).Where(pubDate => pubDate.PubDate <= DateTime.Now).Take(10))
{
<li><a href="@postTitle.AbsoluteUrl">@postTitle.Title</a></li>
}
</ul>
</li>
//cdn fallback for Bootstrap css
<div id="bootstrapCssTest" class="hide"></div> // (HTML in _Layout.cshtml)
if ($('#bootstrapCssTest').is(':visible') === true) {
$('<link href="\css/bootstrap.min.css" rel="stylesheet" type="text/css" />').appendTo('head');
}
//cdn fallback for Bootstrap js
if (typeof ($.fn.modal) === 'undefined') {
$('<script src="\scripts/bootstrap.min.js">\x3C/script>').appendTo('head');
}
@if (Blog.GetPosts(Blog.PostsPerPage).Count() > Blog.PostsPerPage)
@if (Blog.GetPosts(Blog.PostsPerPage * 2).Count() > Blog.PostsPerPage)
Clear-Host
$hsg = Invoke-WebRequest -Uri http://www.stmarys.eu/sitemap.aspx
$links = $hsg.Links | Where class -eq 'rmLink' | select href
$linksWithDomain = $links | Foreach-Object{"http://www.stmarys.eu/" + $_.href}
$linksWithDomain | foreach{
$webClient = new-object System.Net.WebClient
$webClient.Headers.Add("user-agent", "PowerShell Script")
$output = ""
$output = $webClient.DownloadString($_.toString())
if ($output -like "*supportLists*") {
<br/>
<h3>Most recent visitors</h3>
<script>
(function doPoll() {
var count = 0;
$.ajax({
url: "http://YOUR_DOMAIN_NAME/plugins/clientaspxfiles/stmwhoonline.aspx",
dataType: "json",
success: function (json) {
var strHtml = '<ul>';