powershell

Quick PowerShell for the win

I’m always grabbing useful PowerShell commands or small scripts that I find useful.

Here a couple from this week.

I needed to deploy a shortcut to our users desktop with Intune. Looks like its not a built in feature of Intune yet so PowerShell for the win.

$new_object = New-Object -ComObject WScript.Shell
$destination = $new_object.SpecialFolders.Item("AllUsersDesktop")
$source_path = Join-Path -Path $destination -ChildPath "\\Salesforce.url"
$source = $new_object.CreateShortcut($source_path)
$source.TargetPath = "http://login.salesforce.com"
$source.Save()

The details can be found here

How to deploy custom URL shortcuts with Microsoft Intune (nickydewestelinck.be)


I needed to quickly dump the users of an AD group to a file. Its quick and easy.

Get-ADgroupmember -identity “AD group name” | get-aduser -property displayname | select name, displayname >C:\temp\result.txt

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.