For some time I've used a simple VBScript wrapper in code projects and scheduled tasks to allow silent execution of PowerShell scripts in the user context without displaying a console window: p = CreateObject("Scripting.FileSystemObject").GetParentFolderName(WScript.ScriptFullName) location = p &"\"& WScript.Arguments(0) command = "powershell.exe -nologo -ExecutionPolicy Bypass -File """ &location &"""" set shell = CreateObject("WScript.Shell") shell.Run command,0 … Continue reading QuietShell – Executing PowerShell without a Console Window
Tag: microsoft
Harnessing AI in PowerShell: Prompting like a Pro
Understanding Effective AI Prompting: Core PrinciplesClarity and SpecificityContext is KingStructured Problem PresentationIterative RefinementError Message InclusionVersion and Environment DetailsPerformance RequirementsSecurity ContextCode GenerationCode Review and OptimizationBest Practices ImplementationThe Art of Iterative PromptingStarting with a Basic PromptRefining Your PromptFollowing UpExtended PowerShell-Specific ExamplesScenario 1: Active Directory User ManagementScenario 2: Performance OptimizationUnderstanding AI's Problem-Solving ApproachAdvanced Prompting TechniquesRole-Based PromptingComparative PromptingEducational PromptingThe … Continue reading Harnessing AI in PowerShell: Prompting like a Pro
Harnessing AI in PowerShell: Create a TimeZone Script for Windows Autopilot with AI
Get time zone from geolocation dataConvert IANA time zone to Windows time zoneAdd logging, error handling and create a summaryConclusion In this post I want to walk through a real-world example of creating a useable PowerShell script simply by prompting an AI model in conversation. The goal for this script is: to determine the appropriate … Continue reading Harnessing AI in PowerShell: Create a TimeZone Script for Windows Autopilot with AI
Harnessing AI in PowerShell: Create a multi-model command-line AI assistant (Part 2)
Prepare the PowerShell scriptScript parametersModel and API parametersModel parametersAPI parametersSet Az ContextUpdate your PowerShell profile scriptLet's chat!Use the defaultsOutput to browserUse different AI modelsInclude token statisticsReview session statisticsStart a new chatReview your chat historyIncrease the max tokens countProvide a context fileSearch the internet with AIChange the system promptSend multiple promptsChange the temperatureConclusion In our last … Continue reading Harnessing AI in PowerShell: Create a multi-model command-line AI assistant (Part 2)
Harnessing AI in PowerShell: Create a multi-model command-line AI assistant (Part 1)
Azure AICreate a projectAdd AI modelsGrant role permissionsMonitoring cost and usageAnthropic AIOpenAIGoogle AIX AIPerplexity AIStoring your API keys in Azure KeyVaultConclusion AI is virtually inescapable these days. From annoying website chat bots to the assimilation of the Microsoft product portfolio by Copilot, AI has been busy spreading its tentacles every which way it can. I … Continue reading Harnessing AI in PowerShell: Create a multi-model command-line AI assistant (Part 1)
Getting an access token for Microsoft Entra in PowerShell using the Web Account Manager (WAM) broker in Windows
Some months ago, in my quest to look at different methods for obtaining an access token interactively for Microsoft Graph in PowerShell, I wrote a simple PowerShell wrapper around the Microsoft.Identity.Client library, aka MSAL.Net - the supported MS library for authenticating with Microsoft Entra. Microsoft's apps and modules have been trending toward using the Web … Continue reading Getting an access token for Microsoft Entra in PowerShell using the Web Account Manager (WAM) broker in Windows
Activating PIM Roles that require MFA or Conditional Access Authentication Context with PowerShell
For some time, I've been activating and scheduling activations for Azure roles under Privileged Identity Management (PIM) using the Microsoft Graph PowerShell SDK. However recently we secured these role activations to require a conditional access authentication context with MFA. This basically requires me to MFA when I activate a role with PIM. Problem is, by … Continue reading Activating PIM Roles that require MFA or Conditional Access Authentication Context with PowerShell
Investigating Safeguard Hold 54762729 for Windows 11 24H2
!! UPDATE 2024-11-12 !! Microsoft have now documented this safeguard as well as patching it in the December 10, 2024 Windows updates. Read more about it here. A few days ago I happened to be reviewing our feature update Power BI report and noticed that a number of devices were now being blocked from upgrading … Continue reading Investigating Safeguard Hold 54762729 for Windows 11 24H2
Popping Toast Notifications in PowerShell Core
If you've ever popped a toast notification in PowerShell using the Windows Runtime (WinRT), you've probably discovered that, whilst it works fine in PowerShell 5, it doesn't work at all in PowerShell Core (5/6/7+). That's because the WinRT assemblies are not included in PowerShell Core - WinRT is an exclusively Windows thing and PowerShell Core … Continue reading Popping Toast Notifications in PowerShell Core
Intune Assignments Report
If you've ever wanted to see all of your assigned items in Microsoft Intune in one place, my Intune Assignments report may be your friend 🙂 Using Azure automation, assigned items are exported from Microsoft Graph on a schedule and sent to an Azure storage account in CSV format. A Power BI report connects with … Continue reading Intune Assignments Report