I want to all your help on this, We need to change the Screen resolution through our fixlet to high level like 1366*768, If you have any idea about this or any command can change this means it will more helpful for us.
And i tried with powershell command and for that i create a .bat file to change display resolution its worked when i manually run but through our fixlet its getting failed.
Are you sure this file exists when the agent is running the action? I would debug by placing the file permanently to C:\temp\des.bat or by using the file directly in the download folder.
If you would like to upload your fixlet to Bigfix.me, I could take a look at it.
<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<Task>
<Title>Software Distribution - Deploy: Display Resolution</Title>
<Description><![CDATA[This task will deploy: Display Resolution.<BR><BR>This task is applicable on: Windows 2008, Windows 2008 x64, Windows 7, Windows 7 x64, Windows 2008 R2, Windows 8, Windows 8 x64, Windows 2012, Windows 8.1, Windows 8.1 x64 and Windows 2012 R2. ]]></Description>
<Relevance>((name of it = "Win2008" AND NOT x64 of it) OR (name of it = "Win2008" AND x64 of it) OR (name of it = "Win7" AND NOT x64 of it) OR (name of it = "Win7" AND x64 of it) OR (name of it = "Win2008R2") OR (name of it = "Win8" AND NOT x64 of it) OR (name of it = "Win8" AND x64 of it) OR (name of it = "Win2012") OR (name of it = "Win8.1" AND NOT x64 of it) OR (name of it = "Win8.1" AND x64 of it) OR (name of it = "Win2012R2")) of operating system AND TRUE</Relevance>
<Category>Software Distribution</Category>
<DownloadSize>1767</DownloadSize>
<Source>Software Distribution Wizard</Source>
<SourceID></SourceID>
<SourceSeverity></SourceSeverity>
<CVENames></CVENames>
<SANSID></SANSID>
<MIMEField>
<Name>x-fixlet-source</Name>
<Value>Software Distribution Wizard</Value>
</MIMEField>
<MIMEField>
<Name>x-fixlet-modification-time</Name>
<Value>Fri, 26 Feb 2016 12:04:24 +0000</Value>
</MIMEField>
<Domain>BESC</Domain>
<DefaultAction ID="Action1">
<Description>
<PreLink>Click </PreLink>
<Link>here </Link>
<PostLink>to initiate the deployment process.</PostLink>
</Description>
<ActionScript MIMEType="application/x-Fixlet-Windows-Shell">
prefetch fca6e54285ddcdf2ba8923c5aded6566f8877496 sha1:fca6e54285ddcdf2ba8923c5aded6566f8877496 size:1767 http://ROOT_SERVER_FQDN:52311/Uploads/fca6e54285ddcdf2ba8923c5aded6566f8877496/Desplay.tmp sha256:7cebcd1be59bf171356d681ce9fe3bfabe207233f7337555edaa6ceda86197d6
extract fca6e54285ddcdf2ba8923c5aded6566f8877496
wait RunAsCurrentUser "C:\Program Files (x86)\BigFix Enterprise\BES Client\__BESData\actionsite\__Download\des.bat"
</ActionScript>
<SuccessCriteria Option="RunToCompletion"></SuccessCriteria>
</DefaultAction>
</Task>
</BES>
I have two files, one is power-shell script file and another one is batch file, I need to copy and place both files into a client machine on same folder and run the batch file from our bigfix
Please help me to achieve this, when i using following action script its getting failed on last step.
Another issue that might be there is we don’t inherit the user’s session when we run as the logged on user so it won’t affect their logged in session at all. This type of operation doesn’t really make sense to change another session’s settings so its not as trivial as it sounds.
I have never done this using PowerShell. I’m also not certain that it needs to be run as the current user to do this.
If you really want us to be able to debug your code, then you need to provide the contents of the BAT file you are using, as well as the contents of the PowerShell script. Just paste them into the forum and I can fix any formatting issues after the fact.
Also, if you are going to post things to the forum, be sure to redact your root server URL and similar info.
I ran into this issue today and was having the same problem where the command worked when I was on the box, but not via BigFix. Like Alan alluded to, the issue is that the system account is limited to what it can do graphically due to session 0 isolation.
What ended up working for me was creating a small batch file to get the value of the console session, then running the resolution utility using psexec. A similar solution with one of the utilities @jgstew mentioned should work for you as well.
delete __createfile
delete run.bat
createfile until _end_
@echo off
for /f "tokens=3 usebackq" %%i in (`query session console`) do (set CurrSessionId=%%i)
psexec -acceptEula -h -i %CurrSessionId% -c chgres.exe 1024 768 refreshrate=60
_end_
move __createfile run.bat
override wait
hidden=true
completion=job
wait run.bat
Thanks for the follow up @Sean , this is a very helpful batch file you have provided, and not just for this use case.
I haven’t played with PSExec’s other options like influencing different sessions like this, but I can see how it may solve some of the edge cases I run into.
I do wonder if you can get the current session id with relevance somehow.
Yes, exactly. This is what I ended up changing it to:
parameter "DesiredScreenWidth" = "1024"
parameter "DesiredScreenHeight" = "768"
parameter "DesiredRefreshRate" = "60"
parameter "SessionId" = "{unique value of session ids of (current users;logged on users) whose (not remote of it)}"
if {(parameter "DesiredScreenWidth",parameter "DesiredScreenHeight", parameter "DesiredRefreshRate") != (string value of property "CurrentHorizontalResolution" of it, string value of property "CurrentVerticalResolution" of it, string value of property "CurrentRefreshRate" of it) of select object "CurrentHorizontalResolution,CurrentVerticalResolution,CurrentRefreshRate from Win32_VideoController" of wmi}
waithidden psexec -acceptEula -h -i {parameter "SessionId"} chgres.exe {parameter "DesiredScreenWidth"} {parameter "DesiredScreenHeight"} refreshrate={parameter "DesiredRefreshRate"}
endif
P.S - I tried using the “metric” relevance you referenced in Change Screen Resolution - Policy Action but for whatever reason it didn’t seem to reliably report the current resolution as I was changing it back and forth during testing.
I also got rid of the “-c” argument for psexec, I realized it doesn’t really apply since psexec is calling the exe on the same device. It was a leftover artifact of when it used to be a command called from another device.