Have any idea using powershell how to enable and disable "Alloww active content to run in files on my computer" in IE properties..
This worked for me !
When the HTML page is loaded from local machine (local file path), the ActiveX control can be blocked by the Local Machine Lockdown feature. You should be able to workaround it by adding a mark-of-web
(<!-- saved from url=(0014)about:internet -->) at the beginning of your HTML page.
You can achieve the same from registry Key. First create the registry key iexplore.exe (Dword)
in the path HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\FeatureControl\FEATURE_LOCALMACHINE_LOCKDOWN
If you set the value to 1 the 'Allow active content to run in files on my computer' will be unchecked.
If you set the value to 0 the 'Allow active content to run in files on my computer' will be checked.
Related
I am trying to use powershell to change the path environment variable in my account for my company laptop.
I have tried to use [System.Environment]::SetEnvironmentVariable('Path','mypath','User')
It will only set the path under User Variable
When I tried [System.Environment]::SetEnvironmentVariable('Path','mypath','Machine')
I got an exception saying "Requested registry access is not allowed"
However, when I do start>Edit environment variables for your account> I can click and change the System Variable without issue.
Is there a way to do the same as above from powershell?
EDIT: there are 2 options from the start panel, "Edit environment variables for your account" and "Edit the system environment variables". I do not have the Admin right, so I can only access the first option which I can edit system variables from there.
How can this procedure be done with ahk script
If I press Ctrl+Q
It opens chrome.
Selects Mayank Profile, enter image description here, opens www.google.com and www.yahoo.com in it.
As of now Mayank chrome is running, then Selects Julia profile and opens www.gmail.com and www.yahoomail.com.
As of now Now Three chrome will be opening right, One the chrome that is launched firstly, Mayank secondly, Julia the third. As I have to work with these two chromes(2nd and 3rd)
It closes the first chrome.
and I end up having only two chromes opened and julia is activated which contains www.gmail.com and www.yahoomail.com as shown in the picture.
enter image description here
Note: All this happens if I press Ctrl+Q
You can set a flag for chrome.exe when you launch it, so that it starts in a specific profile. An example of the command is this:
chrome.exe --profile-directory="Default" https://stackoverflow.com
The above code will launch this site, while using the profile-directory "Default" which is the default profile for Chrome. You can substitute "Default" with any other profile-directory. However, the name for the directory is not the same as the one set in the profile inside of the browser. All manually created profile-directories are named Profile # where # is a digit increasing from 1 for each created profile.
For example, I have created the following two profiles:
The default path for the Profiles is:
C:\Users\<user>\AppData\Local\Google\Chrome\User Data\
Looking in the folder I can find two folders named:
Profile 1\
Profile 2\
To make it easier to determine what user corresponds with which folder, you can open the file Preferences inside of each of those folders. Inside of that JSON-File, you can search for the key "name": which will contain the name you've set inside of the GUI.
After you've determined what folders are for the profile you want, then we can create the hotkey we're after:
^q::
Run, chrome.exe --profile-directory="Default" https://stackoverflow.com/
Run, chrome.exe --profile-directory="Profile 1" https://superuser.com/
Run, chrome.exe --profile-directory="Profile 2" https://www.google.com/ https://www.duckduckgo.com/
Every day when I log into VDI my vscode extensions get removed on a daily basis.
So I need to install them every day. Is there any walk around to keep the extensions with persistence and that I don't have to download/install it again on a daily basis when ever I log in.
Any help would be much appreciated and thanks in advance.
It seems that you are using a nonpersistent VDI, so you should ask your IT to install the vscode extensions that you need in the image stored in the servers.
Excerpt retrieved here:
There are two main approaches to VDI: persistent and nonpersistent. Persistent VDI provides each user with his or her own desktop image, which can be customized and saved for future use, much like a traditional physical desktop. Nonpersistent VDI provides a pool of uniform desktops that users can access when needed. Nonpersistent desktops revert to their original state each time the user logs out.
Found this on GitHub and it is down near the bottom... https://github.com/microsoft/vscode/issues/17691
Create an environment variable named VSCODE_EXTENSIONS. Set the path you wish the extensions to be stored. We used a network share in our implementation to keep extensions persistent in a non-persistent VDI. (e.g VSCODE_EXTENSIONS = \\Server\Share\%USERNAME%\.vscode)
This environment variable must be in place before VSCode launches. We are utilizing this with VSCode 1.52.1 and it is working for us.
This is how I got it to work in my environment. You need to install the extensions using the .vis format, and then copy the extensions from that local profile to a location any user can access. After that, create a GPO that will run this script at every logon and set the scope to your VDI access AD group. The logon GPO is located at User Configuration > Policies > Windows Settings > Scripts > Logon > Powershell This may be a crude way of doing it, but it's working in my environment.
#This will not work unless there are extensions on the root of the default user
#folder. Install Visual Studio Code and its extensions first, then copy the
#entire "\.vscode" folder from the user profile you installed it into and onto
#the default user profile root folder.
#This script tests to see if the extensions already exist in the root folder of
#the user logging in using the path described in the below variable.
$vscodeextensions = "$env:USERPROFILE\.vscode\extensions\ms-vscode.cpptools-
1.13.2"
#This will just allow the script to run.
Set-ExecutionPolicy bypass
If(-not(Test-Path $vscodeextensions)){
Copy-Item -Path "C:\Users\Default\.vscode\" -Destination "$env:USERPROFILE\"
-Force -Recurse
}
else{
Write-Host "Extensions already copied"
}
I would like for your suggestion to see if there a way to tell who accessed/modified/delete a specific file on windows using Powershell command or batch command without the need to turn on file level logging on a windows host? The following Powershell command doesn't necessarily give me the username of who modified the file.
Get-ChildItem 'C:\Test Folder' | Where {$_.LastWriteTime} | select -last 1
Windows file auditing is not on by default. If the file is not currently reporting audit information, you will not be able to get this information. if you choose to turn it on, future auditing event information is logged into a Windows log. It is not stored in the file metadata. (caution: turning on file auditing can result in an inadvertent denial of service due to the large amounts of data potentially generated.)
Auditing can be enabled by open file Explorer and navigating to the folder/file you wish to audit.
Right click on the file
Select Security Tab
Click Advanced button
Click Auditing Tab (elevate privledges)
Click Add
Select a Principle (can be Users or Domain Users), Select which permissions you wish to audit (maybe Write)
Click OK
Once this is done, audit entries should show up in the Windows Security log.
I have a PowerShell script that checks that a certain directory is on the PATH (by looking through $env:path). It appears that $env:path is loaded and locally scoped by each application on startup, and that scope is passed on to any child applications. So... if someone opens Firefox, downloads my program, runs it, gets a message that they should change their path, fixes the problem, then runs the program again from the Firefox downloads window, they'll get the same message, unless they start my program from Explorer or restart Firefox.
Is there a way to reload $env:path in my PowerShell script so it'll get the current value, as if it were opened from Explorer?
If you were running outside the context of a browser I would tell you to use
[System.Environment]::SetEnvironmentVariable(string name, string value, EnvironmentVariableTarget target)
to change the Path variable for the user. That third parameter allows you to specify Process, User or Machine. If you specify either User or Machine the change is permanent and will appear in the env blocks of all programs that start after that. However, since you are running within the browser I don't think you would be able to do that.
If the user changes their path, that change will be available to future instances of the browser. Another option is to test (Get-Command) for the app you need in the path and if you can't find it, modify $env:Path yourself in the script each time it runs. That is, unless you don't know what the path should be.