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
Related
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.
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.
I downloaded the MongoDB for Windows 64-bit from http://www.mongodb.org/downloads.
File name: mongodb-src-r3.0.3.zip
However, the zip folder doesn't have a bin folder & no .exe files to use for installation (as given in the installation steps).
The below commands say that I use Windows 7 64-bit architecture.
wmic os get caption
wmic os get osarchitecture
Even tried using the .msi (Installation Package) given in the same downloads page. It doesn't give any error. But still the bin folder is not created to test MongoDB (mongod.exe).
Am I missing something?
I also faced the same problem as #ArcherGilly told to install again and select the custom options and by doing this finally I found the bin folder with other txt file like license
C:\Program Files\MongoDB\Server\4.0 -> Previously there were only two folders
data
log
and Now along with the above two folders, there is bin folder along with 4 more files
LICENSE-Community.txt
MPL-2
README
THIRD-PARTY-NOTICES
THIRD-PARTY-NOTICES.gotools
I had the same problem, but once I used the .msi installer and selected 'custom', instead of 'complete', it installed the /bin folder.
I had the same issue.
It could be because you changed the installation directory to another drive where the windows folder isn't.
So if this your case, simply find the bin folder in the C: drive.
After the installation, I used the installer and chose the make changes option without making really any changes. After the process was finished I found the bin folder.
After downloading the msi and installation process. I found the bin folder but there is no mongo.exe file in that folder.
But when I run the path enclosed in " \mongo.exe" in command prompt, the mongo db is running.
while using .msi installer please select 'custom', instead of 'complete', it will create the bin folder at \Installation_Dir\MongoDB\Server\4.2\bin\
Thanks
I use PowerGUI to convert my PowerShell scripts to executables, and it is working fine.
I'd like to prevent my compiled script from being extracted or decompiled by users I distribute the generated executable to.
Is it possible to view my PowerShell script inside the generated executable? If so, how do I prevent this?
Unfortunately with PowerGUI it's not possible to prevent users of your executable from viewing your script, even if you use the "Protect script source code with a password" option.
The executable that PowerGUI generates is a self extracting ZIP file so it's possible to use 7-zip or WinRAR to open this file and view the original PowerShell script.
If you set a password using the "Protect script source code with a password" option all this does is password protect the files inside the ZIP container. However when launching the generated executable you'll be prompted for said password which can then be used to access the original script.
If you want to somewhat obfuscate the code, look at PS2EXE:
http://ps2exe.codeplex.com/
which points to:
https://gallery.technet.microsoft.com/PS2EXE-Convert-PowerShell-9e4e07f1
download the ps2exe
http://ps2exe.codeplex.com/
run power shell
cd the folder of ps2exe
run:
.\yourfile.ps1 -inputFile C:\Users\franc\Desktop\temp\ps2exe\Install.ps1 C:\Users\franc\Desktop\temp\ps2exe\Install.exe
check the folder, the exe will be there
I have a zip file in my ftp server. Is there any way to unzip it using NAnt?
Here is a sample code of what I would like to do:
<ftp connection="liveAuditToolConnection" remotedir="/remotedir">
<unzip zipfile="backup.zip"/>
</ftp>
Suppose that the backup.zip file already exists in the ftp server.
thanx:)
NAnt does not support remote operations. If you are running on a Windows system, trying looking at PSExec