Urgent.News

What's breaking now, across thousands of outlets.

Tech

Comment sécuriser et automatiser vos scripts PowerShell en entreprise

Pourquoi l'exécution non contrôlée de scripts PowerShell est un risque Dans les environnements Active Directory et Azure AD, l'automatisation via PowerShell est indispensable pour la gestion de parc et le nettoyage des caches système. Cependant, laisser des scripts non signés s'exécuter en tâches planifiées sans contrôle d'intégrité expose votre infrastructure à des élévations de privilèges et à…

Original French Read in English

Running uncontrolled PowerShell scripts poses a significant risk in Active Directory and Azure AD environments as automation via PowerShell is essential for managing inventories and cleaning system caches. Allowing unsigned scripts to execute via scheduled tasks without integrity control exposes infrastructure to privilege escalation and malicious runs. To achieve maximum security, a strict execution policy coupled with automated log analysis analysis is crucial in any modern SecOps strategy.

Firstly, configure a strict ExecutionPolicy using Group Policy Objects (GPO) or Microsoft Intune. The RemoteSigned or AllSigned parameters ensure only internally developed or locally signed scripts can run. RemoteSigned only requires signing for scripts downloaded from the internet, while AllSigned applies to all scripts, including internal ones.

The latter is recommended for servers and admin workstations. Note that the Group Policy takes precedence over Intune settings and command-line execution policies. Get-ExecutionPolicy -List displays the value retained at each level.

Secondly, sign your scripts with a code signing certificate. An AllSigned policy only works if your own scripts are signed. The certificate must be from an internal certification authority (AD CS Code Signing template) and deployed via GPO into the trusted publisher store on devices. Without it, each execution prompts confirmation, and scheduled tasks that cannot respond fail. $cert = Get-ChildItem Cert:\CurrentUser\My -CodeSigningCert | Select-Object -First 1 $signature = @{ FilePath = .\Clear-TempFiles.ps1 Certificate = $cert HashAlgorithm = SHA256 TimestampServer = http://timestamp.digicert.com } Set-AuthenticodeSignature @ signature ( Get-AuthenticodeSignature .\Clear-TempFiles.ps1 ) . Status # Valid

Three details matter: HashAlgorithm, TimestampServer, and the impact of any modifications. Windows PowerShell 5.1 uses SHA-1 by default, but it still signs scripts. TimestampServer maintains signature validity post-certificate expiration. Any change, even a single space, results in HashMismatch and script denial. This is the desired integrity control.

Sign within your pipeline instead of locally to keep the private key in a secure vault, ensuring only code from the main branch receives a signature. Before this step, the repository passes the same controls as any other code, including static analysis with PSScriptAnalyzer and detection of accidentally commited secrets.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Stripe Checkout Succeeds but Your App Never Records the Payment: How to Fix It

The error The customer pays, Stripe shows the payment as succeeded, but your database never updates and the user doesn't get access.

  • Stripe Checkout payments appear successful but may not record in app database
  • Misconfigurations or webhook failures often cause the issue
  • Incorrect webhook secret or unreachable endpoint can prevent payment recording

The Second Year: What Twenty Client Apps Cost to Keep Alive

Every article about this business, including ours, is about getting to the first sale. Here is the part that decides whether the business is still there in year three: what it costs to keep twenty…

  • $1,980 annual cost for Apple Developer Program for 20 client apps
  • Codemagic build minutes reset monthly, potential cost surprises
  • 20 renewal dates to manage, including provisioning profiles and push certificates

I picked frameworks to look different, it took me years to notice

I write about programming at invasikode.com , and I have been writing code since high school. My day job now is mostly backend and AI plumbing, which is a strange place to arrive at for someone who spent years caring a lot about front end frameworks. This post is about those years.

  • Author chose different web frameworks to stand out, not technical reasons
  • Habit developed early with limited experience, provided sense of belonging
  • Settled on vanilla stack, values Vue and Nuxt for versatility

More from Friday 30 October →