Hi All,
I have an issue to take *screenshot on Remote Desktop using Ansible*.
I am executing a powershell script which will be taking screenshot, it is
working fine on local system but when I execute on Remote Desktop it is
taking as blank image.
I have used below *win_scheduled_task* and *psexec.exe* but both results in
blank image.
Please find below playbook and powershell script, please check and let me
know how to make it work.
----------------------------------------------------------------------------------------------
- name: create task that runs under a user's interactive desktop launch
* win_scheduled_task:*
name: Interactive Process
actions:
- path: C:\screenshot.ps1
triggers:
- type: registration
#logon_type: s4u
logon_type: interactive_token
username: ansible
#password: wipro@123
-------------------------------------------------------
- name: screenshot
win_shell: 'C:\*psexec.exe* -s -i 1 POWERSHELL -WindowStyle Hidden
-file "C:\screen.ps1"'
------------------------------
powershell script
--------------------------------
Start-Sleep -Seconds 3
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName System.Windows.Forms
$screen = [System.Windows.Forms.SystemInformation]::VirtualScreen
$Bitmap = new-object System.Drawing.Bitmap ($screen.width),($screen.height)
$Size = New-object System.Drawing.Size ($screen.width),($screen.height)
$FromImage = [System.Drawing.Graphics]::FromImage($Bitmap)
$FromImage.CopyFromScreen(0,0,0,0,$Size,([System.Drawing.CopyPixelOperation]::SourceCopy))
$Bitmap.Save("C:\Users\ansible\AppData\Local\Temp\PrintScreen.png",
([system.drawing.imaging.imageformat]::png))
-------------------
Thanks
Raviteja
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/28d544be-b127-4ee2-a867-76cd275ceb65%40googlegroups.com.