Quantcast
Channel: Windows Automation Snapin for PowerShell
Viewing all 129 articles
Browse latest View live

New Post: Taskbar

$
0
0
You'll have to use the script version, and the best approach depends on your version of Windows

It's on chocolatey so if you haven't got it, you can install it with PoshCode's Install-Module WASP or if you don't have PoshCode installed yet, you can install that and WASP at the same time using:
Start-Service WebClient # to start the webDAV client
\\PoshCode.org\Modules\Install WASP
I think what you need is just Invoke-Window.SetWindowVisualState
you should be able to bring any task to to "Normal" and then set focus with:
Select-UIElement -class icoGoogle | Invoke-Window.SetWindowVisualState -state Normal -Passthru | Set-UIFocus
Having said that, with the latest versions of WASP I added the Add-Input and Send-Input commands which are ... well ... awesome ;)

For instance, you can send WIN+T to basically tab through the buttons on the taskbar, or, if you have pinned the apps and can be sure of their order on the taskbar, you can use WIN and a number key to invoke them:
add-input -keypress VK_T -Modifiers LWIN | 
add-input -keypress VK_T -Modifiers LWIN | 
add-input -keypress VK_T -Modifiers LWIN | Send-Input
Or
add-input -keypress VK_4 -Modifiers LWIN | Send-Input

New Post: Taskbar

$
0
0
Ok, so I couldnt get this done. I went to chocolatey and managed to download wasp.2.5.0.1.nupkg, and I am not sure how to install it. I tried your Start-Service WebClient line and all I ever see from that is down in the ISE that Intellisense is closing or that it timed out. Not sure how to add the \poshcode.org\modules\install WASP as a argument to that...

I went to posh code and tried to execute this command to install
iwr http://PoshCode.org/i -OutF PC.ps1; .\PC; rm .\PC.ps1
and got an error that Import-AtomFeed is not recognized as the name of a cmdlet, function, script file, or operable program.

So how do I get there from here?

New Post: Taskbar

$
0
0
Ok got chocolatey installed ran cinst WASP but still could not get any of the new elements to work

do I need to point chocolatey at wasp.2.5.01.nupkg to install?

New Post: Taskbar

$
0
0
Heh. \\PoshCode.org\Modules is a WebDAV server ... so that's not an argument, it's a command. There's a script "Install.ps1" in that folder, you can open up the folder in explorer to see it, and then just run it from PowerShell \\PoshCode.org\Modules\Install.ps1

Of course, I don't know what that error about AtomFeed is. The "http://PoshCode.org/i" link is just a web shortcut to that Install.ps1 script, so I can't imagine how you could download it and run it and yet not have the command, which is defined in that file ;-)

Anyway, if you used Chocolatey instead of PoshCode, you probably ended up unzipping the package in C:\Chocolatey\lib\wasp.2.5.0.0\ instead of in your PSModulePath ... You'll want to:
copy-item C:\Chocolatey\lib\wasp.2.5.0.0\*  ~\Documents\WindowsPowerShell\Modules\WASP -Recurse

New Post: Unable to Import WASP

$
0
0
Had to reboot after unblocking wasp.dll

New Post: WASP and the Windows OSK (On-Screen Keyboard)

$
0
0
Hello,

I've been looking around for a way to control the placement of the Windows On-Screen Keyboard via script. After a lot of searching (and a lot of failed VBScripts) I came across this tool.

The only problem is, Set-WindowPosition doesn't seem to work with the OSK window.

In other words, the following command works:
select-window notepad | select -first 1 | set-windowposition -x 600 -y 200
But this one does not:
select-window osk | select -first 1 | set-windowposition -x 600 -y 200
It does, however, pull up the OSK if it had been minimized, which I guess is nice (it cuts out a step in the script).

In addition, I can close the window just fine using:
select-window osk | select -first 1 | remove-window
Can anyone tell if I'm doing something wrong or if I want is even possible?

New Post: WASP and the Windows OSK (On-Screen Keyboard)

$
0
0
That window is special, you have to be elevated to move it. If you try it with the new WASP module that's on PoshCode/Chocolatey/PowerShellGet you'll actually get an access denied error:
C:\PS> Select-UIElement -ProcessName osk | Invoke-Transform.Move -x 200 -y 300
Exception calling "Move" with "2" argument(s): "Access is denied"
But it will work from an elevated window.

New Post: WASP and the Windows OSK (On-Screen Keyboard)

$
0
0
Awesome, thanks! I hadn't thought that you'd need elevation to move a window but not to close it.

New Post: Unable to Import WASP

$
0
0
Had this issue also. Just in-case others run into the issue, when i would unblock wasp.dll it wouldnt stick. It ended up being a permissions issue and i had to give myself full control over that folder despite the administrators group having full control. That solved the issue.

New Post: The term is not recognized in ISE

$
0
0
I have been using WASP for the last week for a script I'm currently working on. I have run the installer and I can import the .dll in a command line shell. When I run get-command -module WASP, I get results. If I attempt to do the same thing in ISE I get the error The term is not recognized as the name of a cmdlet, function.... I am calling the import-module function along with setting the execution policy for the local system to unrestricted. I was using this module correctly until I had an issue with Excel. Since rebooting, I have not been able to get this to work correctly in ISE (x86 or x64). I'm currently using PS 2.0 and have also attempted to add AddPSSnapin WASP to my profile.ps1 file.

New Post: The term is not recognized in ISE

$
0
0
That's really weird. Nowadays, you should be able to use Import-Module on the WASP.dll to use it that way.

I guess this is just the final straw, and I should pull down the old .dll version and switch to the script as the preferred release, even though it might be a little harder to get your head around...

New Post: will it work for QWidget type?

$
0
0
Does anyone know if the issue with QWidget controls was resolved?

New Post: will it work for QWidget type?

New Post: Send-Keys to an non active Window

$
0
0
Hello,

i am using WASP since today, and ill try this:

Using WASP which is sending Send-Keys commands to notepad++; but if click on another application the Send-Keys commands will be send to application which i have opened.

Is there a function in WASP where i can send the Send-Keys commands to notepad++ when its not active?

My Script:
ipmo .\WASP.dll
$bla = $false
try {            
$ActiveHandle = [UserWindows]::GetForegroundWindow()            
$FindProg = Get-Process | Where-Object {$_.Name -eq 'notepad++'}
    [Microsoft.VisualBasic.Interaction]::AppActivate($FindProg.ID)          
$FindProg | Select ProcessName, @{Name="AppTitle";Expression= {($_.MainWindowTitle)}}            
} catch {            
 Write-Error "Failed to get active Window details. More Info: $_"            
}
while($bla -eq $false){
Select-Window $FindProg | Send-Keys ('Hello')
Sleep -Seconds 2
Select-Window $FindProg | Send-Keys ('Hello')
Sleep -Seconds 2
Select-Window $FindProg | Send-Keys ('Hello')
Sleep -Seconds 2
}

New Post: Send-Keys to an non active Window

$
0
0
No. It's not possible, in windows (for your protection).

You can't simulate input to an app that doesn't have focus -- because that would allow malicious apps to do anything they wanted.

Even when apps fully support UI Automation, and implement the "Value" field, invoking the SetValue member will require focus. See this example, for instance:
http://msdn.microsoft.com/en-us/library/ms750582%28v=vs.110%29.aspx

New Post: How to send Keys to HYPER-V Console?

$
0
0
Hello,
I'm trying to automate Windows Logon (CTRL+ALT+DEL) when using Hyper-V on Windows 2012 R2 "vconnect" console.

How can I work with this console? I'm only able to see that Window is activate, but I don't know how to send a CTRL+ALT+DEL, and less how to send user+password to perform a Login..

any idea?

Thanks

New Post: maximize window in different session

$
0
0
I am trying to run a PS script to maximize a specific application if it is not currently maximized.
I am currently just looking at the window width to determine the state, if anyone knows a better way please ley me know.

the issue im having is that the script is being run through a remote monitoring app that runs under the SYSTEM account and it forces powershell to run as the same user. because of this my script doesn't work.

this is my script

Add-PSSnapin WASP
$s = select-window 'notepad'
$n = select-window 'notepad' | get-windowposition | Format-Wide -Property Width
if ($n -notcontains 1920)
{
  $s | set-windowposition -Maximize
}
and I have tried launching it via CMD and PS
/c PowerShell.exe -NoProfile -ExecutionPolicy Bypass -Command "& {Start-Process PowerShell -ArgumentList '-NoProfile -ExecutionPolicy Bypass -File ""C:\WASP\maximize.ps1""' -Verb RunAs}"

I know its running because I can change it to
[Environment]::UserName | out-file c:\wasp\test.txt

and it outputs SYSTEM...


any ideas on how to get this to run under the currently logged in user?

New Post: maximize window in different session

$
0
0
I think invoking code "as" the user from system would be a violation of a security boundry ... you'd have to get credentials.

At that point it's a generic problem, and there are lot's of suggestions for how to run scripts as another user out there ;-)

Personally, I think the simplest thing is to use a scheduled task with stored credentials, but I don't know what your exact use case is.

New Post: How to send Keys to HYPER-V Console?

$
0
0
Well, with Hyper-V's Virtual Machine Connection console you have to press Ctrl+Alt+End to send Ctrl+Alt+Del, but I wouldn't be surprised if it was immune to anything but hardware-level faking, since input to the VM is done via virtual hardware. If you want to drive it, you probably need to use a Remote Desktop connection, and driver scripts on the client machine.

New Post: Windows 8 problem

$
0
0
If you put the WASP.dll on a UNC share then security might be blocking you.
I had the same issue. Import-Module appeared to work but I couldn't see any modules.
Once I moved it to the local path everything was good.
Viewing all 129 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>