Dec 012011
 

PowerTip of the Day, from PowerShell.com:

By using PowerShell WMI, you can enumerate the start mode that you want your services to use. To get a list of all services, try this:

Get-WMIObjectWin32_Service|Select-ObjectName, StartMode

If you want to find out the start mode of one specific service, try this instead:

([wmi]‘Win32_Service.Name=”Spooler”‘).StartMode

Oct 112011
 

PowerTip of the Day, from PowerShell.com:

Executing PowerShell Commands with Full Privileges

If a script needs to run only particular commands with full Administrator privileges, you can run those in a separate elevated shell.

$code = “md $env:windir\newfolder | Out-Null”
if ((Test-Path $env:windir\newfolder) -eq $false) {
Start-ProcessĀ  powershell.exe -Verb RunAs -ArgumentList “-noprofile -windowstyle hidden -command $code”
}
if ((Test-Path $env:windir\newfolder) -eq $false) {
‘Folder still does not exist, something went wrong’
} else {
‘Folder was created with admin privileges’
}