The_Observer Posted September 29, 2014 Share Posted September 29, 2014 So i have been pushing myself to get into more powershell. Anyone here got some good powershell scripts for everyday use. Maybe we can get a nice collection to pin here in NeoWin. zhangm 1 Share Link to comment Share on other sites More sharing options...
+rdlenk Subscriber² Posted September 29, 2014 Subscriber² Share Posted September 29, 2014 I tend to use this a lot: start-process "http://technet.microsoft.com/library" /joke A great tool that I use a lot for application deployments though SCCM or simple network shares is the PowerShell App Deployment Toolkit on CodePlex. Highly recommend it if you are doing application deployments or just about any PowerShell script that needs a simple UI for end-users. The_Observer 1 Share Link to comment Share on other sites More sharing options...
Praetor Posted September 30, 2014 Share Posted September 30, 2014 PS is fantastic, you can do anything with it... ...anything.... Link to comment Share on other sites More sharing options...
J_R_G Posted October 6, 2014 Share Posted October 6, 2014 function sudo ([string]$file, [string]$arguments) { $psi = new-object System.Diagnostics.ProcessStartInfo $file; $psi.Arguments = $arguments; $psi.Verb = "runas"; $psi.WorkingDirectory = get-location; [System.Diagnostics.Process]::Start($psi); } Usage: sudo app.exe My prompt function: $global:wmilocalcomputer = get-WMIObject -class Win32_OperatingSystem -computer "." $global:lastboottime=[System.Management.ManagementDateTimeconverter]::ToDateTime($wmilocalcomputer.lastbootuptime) $global:originaltitle = [console]::title function global:prompt { $up=$(get-date)-$lastboottime $upstr="$([datetime]::now.toshorttimestring()) $([datetime]::now.toshortdatestring()) up $($up.days) days, $($up.hours) hours, $($up.minutes) minutes" $dir = $pwd.path $homedir = $env:userprofile if ($homedir -ne "" -and $dir.toupper().startswith($homedir.toupper())) { $dir=$dir.remove(0,$homedir.length).insert(0,'~') } if ([console]::title.length -ne 0) { [console]::title = "$global:originaltitle ? $env:username@$($env:computername.tolower())?$dir ? $upstr" } write-host "$env:username" -nonewline write-host "@" -nonewline write-host "$($env:computername.tolower())" -nonewline write-host "?" -nonewline write-host "$dir" -nonewline write-host "?" -nonewline return " `b" } Puts the up-time in the powershell window title and makes my prompt look like: jgentile@v8?~\Documents\WindowsPowerShell? Both work best when put in "C:\Users\[username]\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" http://poshcode.org also has many great scripts. Mugwump00 1 Share Link to comment Share on other sites More sharing options...
TPreston Posted October 6, 2014 Share Posted October 6, 2014 Replace "this pc" with computername.domain.local $objIPProperties = [system.Net.NetworkInformation.IPGlobalProperties]::GetIPGlobalProperties()if ($objIPProperties.DomainName -eq $null) {$SystemName = ?{0}? -f $objIPProperties.HostName}else {$SystemName = ?{0}.{1}? -f $objIPProperties.HostName, $objIPProperties.DomainName}Set-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID\{20D04FE0-3AEA-1069-A2D8-08002B30309D}" -Value $SystemName -Type string Link to comment Share on other sites More sharing options...
+John Teacake MVC Posted October 10, 2014 MVC Share Posted October 10, 2014 Cool! I am just getting into Powershell too. I have posted a few on my blog. The Scripting Guys from Microsoft have some really good ones occasionally. Link to comment Share on other sites More sharing options...
Recommended Posts