Cleaning up WindowsSDK Install Files via Powershell - powershell

I'm doing a powershell install of WindowsSDK and it leaves a ton of EULA files and other files in my C:\ directory. I tried to find how to clear any temp files in C:\ but the only temp files that are deleted are in the actual %temp% directory. And I'm not hardcoding the names of files to delete.

Related

Unzip and access folder with powershell

I have a powershell script the downloads a zip file with a folder with files within it to the %TEMP% folder and I'm trying to understand how it can be unziped and acessed an exe file within it?
I have made searches both here and on google but I didn't found anything and have no clue how can that be done or evn where to start.
Try Extract-ZipFile cmdlet. Then access the exe where you have extracted the zip file.
Try expand-archive to unzip files. Power shell v5 has it

Cleanup Perl script should not delete a directory that is symlinked to

A cleanup Perl script running periodically deletes old log files, and if the folder is empty, it deletes the folder as well. Unfortunately, there is one exception: it should not delete a directory that is symlinked to.
There's no way to tell if there exists a symlink that directly references a dir. (Same for indirect references.)
The best you could do is check every single file on the entire file system, but even that monumental effort wouldn't be perfect. For example, it won't find symlinks on devices that aren't currently mounted, it won't find foreign symlinks to shared portions of the file system, etc.

Unable to write to a file created by an AutoHotKey script

I have a Dell PC with Win7 64 using what I believe is the latest version of AutoHotKey.
I wrote an Installer App with AutoHotKey to create two directories with a number of sub directories then install an exe program and a number of data files into those directories. The App installs into the existing C:\Program Files and C:\Program Data directories.
The Installer App creates the sub directory C:\Program Files\DSOSort then installs the file DSOSort.exe. The installer App then creates the sub directory C:\Program Data\DSOSort and installs a number of additional sub directories with all the associated text data files.
I used the FileCreateDir and FileInstall instructions in the Installation App to create the directories and install the files.
Everything in the Installer App and in the exe program works as it should except that the exe will not make any changes to the text data files in the newly created C:\Program Data\DSOSort directory. I have to open the directory with Properties and allow Users to Write. Once that is done the exe will change data in the text data files correctly and all is well.
If I change the Installer App to create a directory C:\DSOSort then install all the sub directories and data files in there instead of into C:\Program Data\DSOSort the exe can write to the text file. I do not have to change any permissions with Properties.
I tried using the various copies of the C:\Program Data\DSOSort directory I found in C:\Documents and Settings and also in C:\Users. The exe can read them but no Write.
I only have this problem with newly installed directories and again as I said earlier it can be corrected with Properties.
The exe program was written for people with enough knowledge to run the Installation App but do not understand Properties or making changes to the directories.
I could just leave the data files in a C:\DSOSort directory but would prefer to put them in a C:\Program Data\DSOSort directory.
Is there a way for AutoHotKey to check the user permissions and changing them if necessary before installing the data files?
Is my PC behaving properly? Is it supposed to create directories without allowing Write to the files?
Some of these directories, like "Program Files", require admin privileges to modify. I believe that is why you're experiencing that. Have your app run as an admin and it should be fine. The setting for you EXE can be found in the properties.
The A_IsAdmin built-in variable returns whether the current user has admin rights.

Distributing powershell scripts with dll

I have a powershell script that references dll files and i would like to distribute this script to customers. How can i do this such that the customers don't have to worry installing/referencing correct dll files?
I reference the dll files from within the script in the following way:
Add-Type -Path <local path to dll>
I am looking for a way to either bundle these dll's along with the script , or some way for powershell to install the dll when it runs. The dll's i am interested in are available as following nuget packages:
Sharepoint Client
Active Directory library
You could try copying the dll files to the directory the script is in and then use "$PSScriptRoot\Name.Of.File.dll". Zip the directory and distribute the Zip file.

Specifying a different temp directory for building install4j

When building on my linux machine, I notice that install4j creates directories in my /tmp directory. Unfortunately since my /tmp directory is on a small partition, it fills up quickly. Is there a variable I can specify to have these directories and files be in a different directory than /tmp?
Edit bin/install4j.vmoptions and add
-Djava.io.tmpdir=[path to temp dir]
on a new line.