Jump to content
sadakathullah

Get Windows Restrictions

Recommended Posts

Hi All, I am new to AutoIT and exploring options to use it in my organization. I tried couple of examples and it is fantastic. I am trying to run restrictions test in a pc to see if certain options are disabled like print screen, mstsc etc. I could not get a hang of it. Any help is much appreciated.

Share this post


Link to post
Share on other sites

Hi, get a list of what you want to test, then we go over each one.

To start with the print screen, do you want to test a registry key, or the key itself?

For the mstsc you can run it, and check for it's window with windowexists.


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

Thanks Careca. I will give it a try with your suggestion for MSTSC. 

Printscreen option is restrited for over 100 computers in my office network. Every week we manually check random PCs to see if this restriction is still active, so when I press printscreen on the keyboard it does not take a screenshot. To test it I open paint and do a paste and nothing gets pasted. Then I record the test results in an excel that PrintScreen is disabled and test was successful in that pc.

Share this post


Link to post
Share on other sites

I agree with what i read in forums and such

https://social.technet.microsoft.com/Forums/office/en-US/78840a9c-0666-490a-8cda-939f292cec9f/to-disable-print-screen-through-group-policy

It's kinda stupid to disable print screen, there are lots of ways to get the image anyway, like a smartphone.

Anyway, you could go with the scancode option and disable the key entirely.


Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Share this post


Link to post
Share on other sites

@sadakathullah, welcome to AutoIt and to the forum.

when it comes to testing user restrictions, i find it is best to simulate the user actions and check the system response. for PrintScreen, i would simulate the key being pressed, then check the clipboard for the presence of an image. something like this:

#include <Clipboard.au3>

ConsoleWrite(_IsPrintScreenAllowed() & @CRLF)

Func _IsPrintScreenAllowed()
    ; clear the clipboard
    _ClipBoard_Open(0)
    _ClipBoard_Empty()
    _ClipBoard_Close()
    ; if clipboard is not clear, stop with an error
    If _ClipBoard_CountFormats() <> 0 Then Return SetError(1, 0, True)
    ; send PrintScreen
    Send('{PRINTSCREEN}')
    ; give enough time for the clipboard to finish processing
    Sleep(1000)
    ; check if something exists in the clipboard
    If _ClipBoard_CountFormats() <> 0 Then
        Return True
    Else
        Return False
    EndIf
EndFunc   ;==>_IsPrintScreenAllowed

this function may look long and intimidating, but it is quite simple. a more advanced coder can code it in half the line count, but loose much of its readability.

P.S. i'm curious though, if the GPO you use to restrict PrintScreen also restricts the simulated key press; if you can test the code on a target which you already tested manually, do let me know.

P.S.#2 naturally i agree with the post above, but i found it moot to argue with corporate policies.

 

Edited by orbs

Share this post


Link to post
Share on other sites

Hi Careca,

I agree that there are ways to get a printscreen done like clicking a pic on mobile etc. Restrictions are placed in a way that it is no paper zone and no mobile zone and restricted internet acccess so nothing goes out. Good suggesion to explore on scancode. I will work on that. Thank you verymuch for trigging my thought process

Hi Orbs,

Thank you for the code. I will give it a try in my office pc and I am sure by the way the code flows it will work without a doubt. Thanks a ton. :thumbsup:

Share this post


Link to post
Share on other sites

Hi Orbs

The code worked but surprised me.. it took a screenshot with send print screen command. But pressing the key  on the keyboard does nothing. So the code returns true even if the keyboard key press is not capturing the screen

You are correct. Simulated key is not restricted by gpo in place

Edited by sadakathullah

Share this post


Link to post
Share on other sites
2 hours ago, sadakathullah said:

Simulated key is not restricted by gpo in place

that is interesting. would you be so kind to check if the built-in "Snipping Tool" works under the GPO restriction?

anyway, it seems that the one thing you can check is the proper configuration of the registry key generated by the GPO. use RegRead() for that.

Edited by orbs

Share this post


Link to post
Share on other sites

Hi Orbs,  The restricted settings also blocks built-in Snipping Tool. Basically the windows image is free from any tool or application that allows me to take a screen shot. I am unable to check it. I will give a try using RegRead(). Thanks for your suggestion.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By somebadhat
      Restore blank Windows 10 start menu icons.
      ; RESTORE BLANK WINDOWS 10 START MENU ICONS. ; TOGGLE SETTINGS-START-"USE START FULL SCREEN" TWICE ; THIS WILL RESTORE SOME OF THE BLANK ICONS ; FOR THOSE THAT IT DOES NOT REDO "CHANGE ICON" FROM THE PROPERTIES DIALOG BOX FOR EACH MISSING ICON. ; "C:\Program Files (x86)\AutoIt3\AutoIt3_x64.exe" "F:\MYAPPS\WINDOWS\StartMenu1.au3" ; windows 10 and autoit3 AutoItSetOption ("SendKeyDelay" , "1000") Run(@ComSpec & " /c start ms-settings:personalization-start", "", @SW_SHOWMINIMIZED) Sleep(1000) ; send("{tab 8}{space}{tab 6}") ; Move to "use start full screen", toggle it and (improves reliability) return cursor to "find a setting" search box. MouseClick("left", 379, 490, 1, 0) ; Change as needed. Autoitv3 Window Info MouseClick Coords are 23px north. If y=467 use y=490 Sleep(250) ; Msgbox(0,"Operation halted","Continue?") ; PAUSE FOR DEBUG WinClose("[CLASS:ApplicationFrameWindow]", "") Send("{LWIN 2}") ; OPEN AND CLOSE THE START MENU Run(@ComSpec & " /c start ms-settings:personalization-start", "", @SW_SHOWMINIMIZED) Sleep(1000) ; send("{tab 8}{space}{tab 6}") ; Move to "use start full screen", toggle it and (improves reliability) return cursor to "find a setting" search box. MouseClick("left", 379, 490, 1, 0) ; Change as needed. Autoitv3 Window Info MouseClick Coords are 23px north. If y=467 use y=490 Sleep(250) ; Msgbox(0,"Operation halted","Continue?") ; PAUSE FOR DEBUG WinClose("[CLASS:ApplicationFrameWindow]", "") Send("{LWIN}") ; OPEN START MENU sleep(2000) Send("{LWIN}") ; CLOSE START MENU Exit
    • By Simpel
      Hi,
      at work we changed now from windows 7 to windows 10. Suddenly this command _GUICtrlListView_GetHotItem() isn't working anymore for me. When I drag&drop a listviewitem it always returns -1.
      Here is the script that worked with WIN7:
      #include <GUIConstantsEx.au3> #include <GuiListView.au3> #include <Misc.au3> Local $aArray_Base[5][2] = [["0 - 0", "0 - 1"], ["1 - 0", "1 - 1"], ["2 - 0", "2 - 1"], ["3 - 0", "3 - 1"], ["4 - 0", "4 - 1"]] GUICreate("listview", 220, 200) Global $g_idListView = GUICtrlCreateListView("", 10, 10, 200, 180) _GUICtrlListView_AddColumn($g_idListView, "Col 1", 100) _GUICtrlListView_AddColumn($g_idListView, "Col 2", 100) _GUICtrlListView_AddArray($g_idListView, $aArray_Base) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $GUI_EVENT_PRIMARYDOWN _Arrange_List() EndSwitch WEnd Func _Arrange_List() Local $iSelected = _GUICtrlListView_GetSelectionMark($g_idListView) If $iSelected = -1 Then Return While _IsPressed(1) WEnd Local $iDropped = _GUICtrlListView_GetHotItem($g_idListView) ConsoleWrite("GetHotItem: " & $iDropped & @CRLF) If $iDropped > -1 Then _GUICtrlListView_BeginUpdate($g_idListView) If $iSelected < $iDropped Then _GUICtrlListView_InsertItem($g_idListView, "", $iDropped + 1) _GUICtrlListView_SetItemText($g_idListView, $iDropped +1, _GUICtrlListView_GetItemTextString($g_idListView, $iSelected), -1) _GUICtrlListView_DeleteItem($g_idListView, $iSelected) ElseIf $iSelected > $iDropped Then _GUICtrlListView_InsertItem($g_idListView, "", $iDropped) _GUICtrlListView_SetItemText($g_idListView, $iDropped, _GUICtrlListView_GetItemTextString($g_idListView, $iSelected + 1), -1) _GUICtrlListView_DeleteItem($g_idListView, $iSelected + 1) EndIf _GUICtrlListView_SetItemSelected($g_idListView, $iDropped) _GUICtrlListView_SetSelectionMark($g_idListView, $iDropped) _GUICtrlListView_EndUpdate($g_idListView) EndIf EndFunc Any ideas?
      Regards, Simpel
       
      P.S. If I click an item then $iDropped is returning the correct number.
    • By gahhon
      I have a application that have a function is to create a shortcut to desktop, lets say is ChromePortable.lnk.
      $iCreate = FileCreateShortcut($DIR_WA_FOLDER & '\GoogleChromePortable.exe', $DIR_SHORTCUT, $DIR_WA_FOLDER, '--kiosk "https://example.com/"') So the shortcut will be launch as kiosk mode and force to enter the specific website. However, the user is still able to right-click on the shortcut and modify the target value to remove the kiosk mode. What can I do to disable the user to editing the target value?
      So far, I had asked and tried from SuperUser for advises Disable Shortcut Target Field
      icacls "ChromePortable.lnk" /GRANT EVERYONE:RX So this will set the permission of this shortcut file to only Read & Execute only! But after I set it, the user is still can modify.
      Please kindly advise.
      Please note and assume that user don't have Administration account or etc, that should be only have 1 account to logon to the computer.
       
      EDIT:
      I must disable inheritance to remove all others permissions like SYSTEM, ADMINISTRATORS, etc. Then only GRANT everyone for READ & EXECUTE only.
      But still the user can go to edit the permissions tho. Any advise?
    • By ur
      When I compiled my script or any script to exe using 32 bit compiler and ran on 32 bit machine, I am getting below error.
       

       
      But it is 32 bit only.
       
      And, for testing, I disabled smart screen also, but same issue.
      Please suggest.
       
    • By stayready40
      Hello all. I created a script to uninstall Symantec from our environment and I placed the "BlockInput(1)" command in the beginning of the script so that end users would not be able to move the mouse or keyboard to disrupt the mouse clicks.
      During testing we found that this worked for our Windows 7 machines, but for our windows 10 machines the mouse disable did not work can anyone shed some light on why this is? 
      Here is my code:

       
×
×
  • Create New...