Tag: PowerShell

PS: Increase Shell Memory Allocation

PS: Increase Shell Memory Allocation

Run the following commands to increase the powershell shell memory allocation when you see “Out of memory exception!”

sl WSMan:\localhost\Shell
dir
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 4096
Restart-Service winrm
Advertisements
PS: Reset Surface Dock Registry

PS: Reset Surface Dock Registry

I found on the odd occasion my Surface Pro 4 dock gets into a bit of a unknown state and I am unable to extend my monitors if you find the same problem try running the following the script

Remove-Item "HKLM:SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Configuration" -Recurse -Confirm:$false
Remove-Item "HKLM:SYSTEM\CurrentControlSet\Control\GraphicsDrivers\Connectivity" -Recurse -Confirm:$false
Restart-Computer
PS: Set Office 365 Room Booking Permissions and delegates

PS: Set Office 365 Room Booking Permissions and delegates

####################################################################
# Room Calendar Booking Config Script By Daisy Stevens
# This script will set the users who have permission to 
#book the room, Configure approving deligates and set Auto Response
####################################################################
# Permitted users who can book against room
$UserList = @(
"User@Example.com","User@Example.com"
)
# Deligates to approve booking requests
$Deligates = @(
"deligate@example.com","deligate@example.com"
)
# Calendar Processing Properties
$CalProcProp = @{
    AutomateProcessing = 'AutoAccept'
    AllBookInPolicy       = $false
    AllRequestInPolicy    = $false
    AllRequestOutOfPolicy = $false
    ResourceDelegates  = $Deligates
    BookInPolicy       = $UserList
    RequestInPolicy    = $null
    RequestOutOfPolicy = $null
    AddAdditionalResponse = $true
    ProcessExternalMeetingMessages = $true
    AdditionalResponse = "This meeting room is a restricted resource. Please wait for acceptance confirmation of your booking"
}
## Set the Calendar Processing Properties
Set-CalendarProcessing "Room Name" @CalProcProp
PS: Enable Smart Screen

PS: Enable Smart Screen


################################################################################
# Enable Smart Screen Powershell Script By Daisy Stevens
# https://adminscriptbank.wordpress.com/
################################################################################
# Configuration Parameters
$SysParams = @{
    Path = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer'
    Name = 'SmartScreenEnabled'
    Value = 'Prompt'
    Force = $true
}
$EdgeParams = @{
    Path = 'HKLM:\SOFTWARE\Policies\Microsoft\MicrosoftEdge\PhishingFilter'
    Name = 'EnabledV9'
    Value = 'dword:00000001'
    Force = $true
}
$StoreParams = @{
    Path = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\AppHost'
    Name = 'EnableWebContentEvaluation'
    Value = 'dword:00000002'
    Force = $true
}

# Add Configuration Function
function Set-SmartScreen {
    New-ItemProperty @SysParams
    New-ItemProperty @EdgeParams
    New-ItemProperty @StoreParams
}

# Function Calls
Set-SmartScreen
PS: Dark Theme For Slack!!!

PS: Dark Theme For Slack!!!

Hi Guys

If you run the below snippet it will push your Slack client into the much needed and sexy dark theme. Give it a go and let me know what you think

set-location $env:LOCALAPPDATA\slack\app*\resources\app.asar.unpacked\src\static
$darkjs=@'
// First make sure the wrapper app is loaded
document.addEventListener("DOMContentLoaded", function() {

   // Then get its webviews
   let webviews = document.querySelectorAll(".TeamView webview");

   // Fetch our CSS in parallel ahead of time
   const cssPath = 'https://cdn.rawgit.com/widget-/slack-black-theme/master/custom.css';
   let cssPromise = fetch(cssPath).then(response => response.text());

   let customCustomCSS = `
   :root {
      /* Modify these to change your theme colors: */
      --primary: #09F;
      --text: #CCC;
      --background: #080808;
      --background-elevated: #222;
   }
   `

   // Insert a style tag into the wrapper view
   cssPromise.then(css => {
      let s = document.createElement('style');
      s.type = 'text/css';
      s.innerHTML = css + customCustomCSS;
      document.head.appendChild(s);
   });

   // Wait for each webview to load
   webviews.forEach(webview => {
      webview.addEventListener('ipc-message', message => {
         if (message.channel == 'didFinishLoading')
            // Finally add the CSS into the webview
            cssPromise.then(css => {
               let script = `
                     let s = document.createElement('style');
                     s.type = 'text/css';
                     s.id = 'slack-custom-css';
                     s.innerHTML = \`${css + customCustomCSS}\`;
                     document.head.appendChild(s);
                     `
               webview.executeJavaScript(script);
            })
      });
   });
});
'@
Add-Content .\ssb-interop.js -Value $darkjs