Desktop Alert Settings in Outlook with Powershell - email

I use Outlook 2013 and Powershell for scripting.
I want modify (enable - disabled) some properties like Desktop Alert.
Tools -> Options -> E-mail Options -> Advanced E-mail Options
When new messages arrive:
Play a sound
Briefly change the mouse pointer
Show an envelope icon in the taskbar
Display a Desktop Alert
Tools -> Options -> E-mail Options -> Advanced E-mail Options -> Desktop Alert Settings -> Preview
$olFolders = "Microsoft.Office.Interop.Outlook.OlDefaultFolders"
$olFolderCalendar = 9
$outlook = New-Object -ComObject outlook.application
$namespace = $Outlook.GetNameSpace("MAPI")
any suggestions?

Most settings like this will be stored in the user's registry. What I would do to find the registry key is compare the registry before and after making the change in Outlook. I use regshot to do this:
https://sourceforge.net/projects/regshot/
Then in PowerShell it will be a simple registry key change to enable or disable.
Set-ChildItem HKCU:\Software\Microsoft\<SomeKey> -Name Blah -Value 1

Investigating further using Process Monitor it would seem there is a thread that accesses some of the values in
HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Common\DesktopAlerts
DWORD: TimeOn
Open registry editor, and go to
HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Preference\ShowEnvelope
Check the DWORD Value of ShowEnvelope, modify it to zero if itsn't.
http://www.outlook-tips.net/tips/tip-245-outlook-2003s-desktop-alerts-settings/

Related

How to press Enter Key within Text box in Power shell?

I am interacting with Web page using Power shell script, Once i logged into the page i need to provide a value to the Text box, after its done, i need to press enter within that text box to start search.
$ie.document.getElementById("textbox-Input-ffd1").value = $value
can you please help how i can achieve that using power shell?
I have tried below script already and it doesn't work as expected, i need it to be specific within text box.
$myshell = New-Object -com "Wscript.Shell"
$myshell.sendkeys("{ENTER}")
Does this work for you?
Add-Type -AssemblyName System.Windows.Forms
[Windows.Forms.SendKeys]::SendWait("{Enter}")

Powershell: Set focus to child window

I am in the processing of Automating Virus Scan Exclusions. Since I cannot write straight to the registry, I am making a macro of sorts using PowerShell. It works pretty well, but I want to ensure that I have the focus of the window I want before I send a slew of key strokes to it.
Using the following code, I get to the VirusScan Exclusions for McAfee.
& 'C:\Program Files (x86)\McAfee\VirusScan Enterprise\mcconsol.exe'
Start-Sleep 5
[void] [System.Reflection.Assembly]::LoadWithPartialName("'Microsoft.VisualBasic")
[Microsoft.VisualBasic.Interaction]::AppActivate("VirusScan Console")
Start-Sleep -m 500
[void] [System.Reflection.Assembly]::LoadWithPartialName("'System.Windows.Forms")
[System.Windows.Forms.SendKeys]::SendWait("{DOWN}{DOWN}{DOWN}%{ENTER}")
start-sleep -m 500
#[Microsoft.VisualBasic.Interaction]::AppActivate("On-Access Scan Properties")
[System.Windows.Forms.SendKeys]::SendWait("{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{DOWN}{TAB}{TAB}{TAB}{RIGHT}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{RIGHT}%E")
start-sleep -m 750
However, there is a chance that focus could not be on the correct window.
Child windows
'On-Access Scan Properties' and then 'Set Exclusions' (as a child of 'On-Access Scan Properties') appear.
Questions:
1) What code can I use to set the focus to a particular subwindow (by title)?
2) What code can I use to test that the window is in fact the focus?
Basically I use and RDP manager to connect to a bunch of different machines. I want to set this script off and forget it. In order to do that, I have to ensure that the proper windows are in focus. It doesn't work well when I am switching between RDP connections.

Automate Windows 7 Ease of Access Setting "Turn off unnecessary animations"

I'm trying to find a away to automatically enable/disable a setting in Windows 7:
From Category view:
Control Panel\All Control Panel Items\Ease of Access Center\Make the computer easier to see
From Icon view:
Control Panel\All Control Panel Items\Ease of Access Center\Make the computer easier to see
The setting:
Turn off all unnecessary animations (when possible)
Some context:
This seems to be a way to disable the animations on Microsoft Office 2013 which are causing an Excel Add-in I wrote to behave sluggishly (the add-in itself does graph interactivity and animation, which chugs badly in Office 2013 with the new graphics hardware accelerated animations). I've tried the within Office setting to disable the animation, but it didn't have any effect after Office restart or reboot, and others have also reported this. Changing settings in the Ease of Access Center or the visual performance settings (Control Panel\All Control Panel Items\Performance Information and Tools > Adjust Visual Effects > Animate controls and elements inside windows) are the best way to remove the animations. The Ease of Access Center method I'm asking for help with doesn't require elevated privileges and works instantly, so if there is a way to automate it, it should be more seemless.
In the end I'd like to toggle the setting from VBA or VB.Net Microsoft Office Add-Ins, but I don't care what form the solution takes (batch file, Windows API, VBS script, PowerShell, etc.) since it should be easy to implement from the add-in. If it comes down to Auto-It style mouse-click automation, I'd rather just give the user instructions and pop up the explorer window for them.
Thanks for any helpful ideas!
"This stuff is also controlled via the computer properties -> advanced-> performance-> visual effect option. If you set it to best performance, all the stuff you want turned off is turned off.
Unfortunately this changes a whole bunch of registry values but if we
just narrow down on the stuff you want, there are 2 registry values
involved:
HKCU\Control Panel\Desktop\UserPreferencesMask
This is a reg_binary value. Change this value from 9E 2C 07 80 12 00
00 00 to 9E 2C 07 80 10 00 00 00 .
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\VisualFxSetting
The VisualEffects key doesn't exist by default. There are a bunch of
values that can be defined under here but the only one that really
matters is VisualFxSettings. Set this to 2 to disable a lot of the
animations and also to tick "Turn off all unnecessary animations (when
possible)" ."
Quote from -> HERE
Run the following powershell, reboot, and you'll be good to go.
PS C:\> Push-Location
PS C:\> Set-Location "HKCU:\Control Panel\Desktop\"
PS HKCU\Control Panel\Desktop> Set-ItemProperty . -Name UserPreferencesMask -Value ([byte[]](0x9E,0x2C,0x07,0x80,0x10,0x00,0x00,0x00))
PS HKCU\Control Panel\Desktop> Pop-Location
PS C:\>
PS C:\> Push-Location
PS C:\> Set-Location HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\
PS HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects> New-ItemProperty . VisualFxSetting -Value 2
PS HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects> Pop-Location

disablinging autorecover option for powepoint

I am not able to find the correct property/method to disable the auto recover option for powerpoint. For Excel and word its as below
For excel this will do it
$wb.EnableAutoRecover = $False
and for word
$word.Options.SaveInterval = 0
Any idea what I need to do for powerpoint? There is an 'Option's read only property.
Most of PowerPoint's Options settings are stored in the registry, usually:
HKCU\Software\Microsoft\Office\xx.0\PowerPoint\Options
You can leave this open in Regedit, change an option in PPT then refresh Regedit to see what's changed.
In this case check:
FrequencyToSaveAutoRecoveryInfo
PowerPoint reads the options settings at startup, writes them out as the user makes changes and again at shutdown but never reads them from the registry again during a session. In other words, if you change the settings while PPT is running:
1) It'll have no effect, and
2) PowerPoint will overwrite your changes when it quits
You need to make any necessary changes while PPT is shut down.

How can I control a window's 'state' (maximize, minimize, restore) with a powershell script?

I need to be able to run this script and have it maximize a window if it isn't already maximized. And restore the window if it isn't. The window is just whatever is currently active so no need to get specific (but bonus points if you do) 8O)
I plan on activating it from a short-cut keystroke.
It does need to run under PS v1 (I know, I know, but I don't have control over the version at work).
Thanks.
Clarification: Since I cannot update PS to v2, I can't install separate applications either. Is there a way to do this with native commands?
Set-WindowPosition – set any one of (or all of) top, left, width, height on a window … or maximize/minimize/restore
Get-WindowPosition – get the position (kind-of redundant, actually, since the Window object has it’s position as a property)
http://wasp.codeplex.com/
This works:
(Get-Host).UI.RawUI
$a = (Get-Host).UI.RawUI
$a.BackgroundColor = "white"
$a.ForegroundColor = "black"
$size = (Get-Host).UI.RawUI.WindowSize
$size.Width = 80
$size.Height = 30
(Get-Host).UI.RawUI.WindowSize = $size
But this doesn't:
$position = (Get-Host).UI.RawUI.Windowposition
$position.X = 0
$position.Y = 30
(Get-Host).UI.RawUI.Windowposition = $position
Just in case you are doing this on your own or your workplace allows open source modules:
I used the UIAutomation powershell module (http://uiautomation.codeplex.com/).
Here is my powershell script to move a window to another monitor(which required going to normal and maximize modes).
Start-Process Chrome
##orient new chrome window in full screen on left monitor
#get reference to new chrome window
$nextWin = Get-UiaWindow -Name "*New Tab*"
#transform window to "restore" mode (make sure window is not maximized)
$nextWin.SetWindowVisualState("Normal")
#move window to left monitor
$nextWin.Move(-1920,0)
#maximize window
$nextWin.SetWindowVisualState("Maximize")
Of course the main takaways here are:
$nextWin.SetWindowVisualState("Normal")
$nextWin.SetWindowVisualState("Maximize")
$nextWin.SetWindowVisualState("Minimize")
And there are quite a few options for getting a window ($nextWin) including a Get-UiaActiveWindow