-
PowerShell advanced function (cmdlet) to modify existing shortcuts (links, LNK files) to start app in elevated mode (Run as Administrator)
I needed to modify tens of existing shortcuts to run referenced applications in elevated mode. It is possible to do it in properties of the shortcut (Advanced – [x] Run as administrator) but I prefer PowerShell (actually .NET Framework) to do bulk operations. I wrote this function for you. Function Set-RvShortcutToRunAsAdministrator { <# .SYNOPSIS Modify…
-
Convert object in PowerShell (for example [PsCustomObject]) into hash table source code
I needed a simple and reusable PowerShell code to convert any object into hash table that can be copy and pasted as source code. I wrote this: $outputItem = ‘@{‘ $MyCustomObject.PSObject.Properties.Name | Where-Object -FilterScript { $_ -ne ‘ComputerName’ } | ForEach-Object -Process ` { if ($interfaceItemIpConfigurationItem.$_ -is [bool]) { $valueItem = ‘${0}’ -f $MyCustomObject.$_.ToString().ToLower() }…