How can I automatically render a Composition to an .mp4 with aerender?
This renders the Composition to an .avi:
aerender -project C:\aeProjects\anim.aep -comp "Main Pogo" -output C:\aeProjects\output\test.avi
I tried to replace .avi with .mp4 like this:
aerender -project C:\aeProjects\anim.aep -comp "Main Pogo" -output C:\aeProjects\output\test.mp4
but did not work.
Does anyone know a solution or a workaround how to accomplish this in the console.
Sorry just saw this tonight. The way to do this is make an output template, one that has the mp4 settings in it, then include it by name by using the -OMtemplate parameter flag, like:
aerender -project C:\aeProjects\anim.aep -comp "Main Pogo" -OMtemplate "nameOfmp4Template" -output C:\aeProjects\output\test.mp4
Related
I am trying to download WAV files via a web API using PowerShell. The request succeeds, but when I write the content to a file using Out-File it will not play in windows media player. It shows like this (opened in text editor):
Whereas a sample wav file that does play, looks like this in text editor:
I am guessing it is some sort of encoding problem? But I don't know how to output to a wav file using proper encoding in PowerShell...
Here is my script, I am currently saving out a substring of "RawContent" to skip all the HTTP headers:
(Invoke-WebRequest -URI 'https://developer.fuze.com/api/v1/call-recordings/recording-id/media').RawContent.Substring(488) | Out-File c:\stuff\recording.wav
I downloaded a file in raw format. Then I converted it to wav using ffmpeg.
This is how I solved this problem:
`$response = $client.PostAsync("https://tts.api.cloud.yandex.net/speech/v1/tts:synthesize", $con)
$responseBytes = $response.Result.Content.ReadAsByteArrayAsync()
[io.file]::WriteAllBytes('.\test.raw',$responseBytes.Result)
.\ffmpeg\bin\ffmpeg.exe -i test.raw file.wav 2> $null
$Player = New-Object System.Media.SoundPlayer '.\file.wav'
$Player.Play()
Remove-Item .\test.raw
Remove-Item .\file.wav`
I have a bunch of task in .xml format. How do I use powershell to register each task from the folder of tasks? Such as Task_1.xml, Task_2.xml etc in a folder called TASK_FOLDER.
Assuming your XML is valid. For my testing I exported a simple task from my system.
One thing that's a little misleading is the -Xml parameter takes a string not an actual XML object. so we need to give it a monolithic string.
$XML = Get-Content c:\Temp\TestTask.xml -Raw
Register-ScheduledTask -XML $XML -TaskName TestTask
Note: Get-Content normally returns an array. The -Raw parameter instructs it to return a single string.
This seemed to work. However I suspect you're going to have an issue, because even with the -XML parameter the -TaskName parameter is mandatory. We need some options so we can automate the task name as well as the configuration.
The first Idea could be to just use the filenames, that might look something like this:
$TaskFiles = Get-ChildItem c:\temp\tasks
ForEach( $TaskFile in $TaskFiles )
{
$TaskName = $TaskFile.BaseName # Use base name, to strip the .xml extension
$XmlString = Get-Content $TaskFile.FullName -Raw
Register-ScheduledTask -Xml $XmlString -TaskName $TaskName -User MyUser -Password MyPassword
}
A second option may be to parse the tag inside the task XML file. In my case the tag looks like: <URI>\TestTask</URI>. So, you can see this is pretty close to the name. We'll need a formal XML object to to work with the URI, but we'll extract the string data when we need to run Register-ScheduledTask
This approach might look something like:
$TaskFiles = Get-ChildItem c:\temp\tasks
ForEach( $TaskFile in $TaskFiles )
{
$TaskXml = [XML]( Get-Content $TaskFile.FullName )
$TaskName = $TaskXml.task.RegistrationInfo.URI.split("\")[-1]
Register-ScheduledTask -Xml $TaskXml.OuterXml -TaskName $TaskName -User MyUser -Password MyPassword
}
Note: $TaskXml.OuterXML refers to the XML's string representation.
Warning: I don't know the tasks schema that well, can't gurantee the
<URI> tag is always present.
A few things to point out for both examples:
The -User & -Password parameters will override what's in the file. This will accommodate both when the password has changed since the XML file was generated or when an obsolete or defunct account is in the XML file.
Strictly speaking I'm not sure password is required just to register. but, be advised you cannot enter it as a secure string and generally you don't want to hard code passwords. If this is for interactive we could probably prompt for the password then extract from the credential object. Either way, as a security concern, be aware of it.
I didn't test either of these, as I don't have tons of task XML files laying around.
For completeness I also tested schtasks.exe, which I've used for this before.
schtasks.exe /Create /XML C:\TestTask.xml /TN TestTask
Output: SUCCESS: The scheduled task "TestTask" has successfully been
created.
Notice that schtasks.exe also requires the name (/TN). You could wrap it in a loop similar to the above examples though. I didn't test updating the username or password.
As I mentioned in the other discussions scheduled tasks can be tough to work with. I really recommend you take a look at the documentation for Register-ScheduledTask. Beyond that you should have enough to work through your issue.
I’m running into this error while trying to convert my Windows Forms Application using Project Centennial. I was able to run threw the shown VLC tutorial on the MSDN site, so I do know the converter is working. It says I need to “set the 'Application Executable' property in the AppxManifest.xml before calling makeappx manually” but I am not sure how to do that. I have tried using -AppExecutable but it’s not setting, every time it builds it defaults to MyApp.exe. It says I can edit it, but when I do not know how to call MakeAppx.exe with the same XML file.
Here is the command I am using:
.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14393 –Installer C:\Users\Mark\Desktop\Newest_Installer\Keyed-Setup.exe -InstallerArguments "/S" -Destination C:\Users\Mark\Desktop\Keyed_App_Filers -PackageName "Keyed" -Publisher "CN=JonesComm" -Version 1.0.2.2 -AppExecutable "KeyedApp.exe" -MakeAppx -Verbose
Here is a picture of the full error.
Error Pic
Thanks in advance for any help you can offer!
Eureka!!! Okay so for about a week solid I have not been able to get this right. I have an MSI and a .exe of my program and I just successfully wrapped the .aapx with the MSI. The command that lead to the break though was “msiexec /?” this shows a list of the commands specifically for that application. “/PASSIVE” is the command needed to run without UI. I was able to set the 'Application Executable' property with “-AppExecutable "Executable(.exe) File Path"-AppInstallPath "Your Applications Installation Path” This is just the name of your applications executable, and where that executable would be located on a new computer after a fresh install.
Here is an editable version of the powershell command I used:
.\DesktopAppConverter.ps1 -ExpandedBaseImage C:\ProgramData\Microsoft\Windows\Images\BaseImage-14393 –Installer C:\Users \Desktop\MyApp\MyApp_Setup.msi -InstallerArguments "/PASSIVE" -Destination C:\Users\Desktop\MyApp-Appx -PackageName "MyApp" -Publisher "CN=Company" -Version 1.0.2.2 -AppExecutable "ApplicationFolder\SubFolder\MyApp.exe"-AppInstallPath "C:\Program Files (x86)\ApplicationFolder\SubFolder" -MakeAppx -Verbose
I hope this helps any newbies out there like me. Project Centennial doesn’t have much for tutorials out there right now. Thanks everyone!!
I am using 7zip on powershell because I need to zip some folders. This is the code I am using:
Set-StrictMode -Version "2.0"
Clear-Host
$7Zip_ProgramPath="C:\Program Files\7-zip\7z"
$Destination = "c:\temp\7ztest41.zip"
$Source = "c:\temp\homes\homeuser002"
$Option = "a"
$Command = "$7Zip_ProgramPath $Option $Destination $Source"
#$Command="C:\Program Files\7-zip\7z a c:\temp\7ztest.zip c:\temp\homes\homeuser002"
$ManagementClass=[System.Management.ManagementClass] "\\.\ROOT\cimv2:Win32_Process"
#kürzer: $$ManagementClass=[WmiClass] "Win32_Process"
$StartupOptions=[WmiClass] "Win32_ProcessStartup"
$StartupOptions.PsBase.Properties["ShowWindow"].Value=1
$null=$ManagementClass.Create($Command,$Null,$StartupOptions)'
I got this code from this page here: http://www.powershellpraxis.de/index.php/ntfs-filesystem/laufwerke-ordner-dateien-und-freigaben#2.1.2.5.2%20Packen%20mit%207-Zip
Everything is working quite good, except for the fact that I do not want to compress my files when using this method. I have a folder which is 67 MB big, but after zipping this folder it is only 55 MB big. Maybe I do not fully understand this code but I want to change the compression option and do not know where and how. Does anybody know?
Your command line is only specifying an 'Add' operation.
$Option = "a"
The 'Add' option does not disable compression in 7z.exe. You need to explicitly configure the compression option to specify 'no compression'.
$Option = 'a -mx=0'
I want to take user dump of a process using powershell How can i do it?
The same I get on rightclicking the process in Taskmanager
Based on this article (archived) from Risksense.
MiniDump function from native comsvcs.dll Windows dll could be used.
Like:
Powershell -c rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump {ID-of-the-process} $Env:TEMP\my_dump_file.bin full
The easiest way is to use Procdump from Sysinternals toolkit. Use Get-Process to get process id, which you can pass to Procdump for actual dumping.
Edit:
I'd still rather use readily available tools instead of the hard way. Have you got a valid business reason? Since you insist, there is a Win32 API call that creates user mode memory dumps. It can be invoked from .Net code, so either use P/Invoke or embed C# into your Powershell code. This is left as an exercise to the reader.
Hi sorry I'm not much help. I've never used a DUP file before. But there is a WMI class called Win32_Process:
Get-WMIObject -Class Win32_Process
Not sure if that's the info you are looking for. Has different properties than Get-Process.
I had a similar use case where I needed to create a dump for an IIS process. Granted I could have used DebugDiag, but I ended up going down this path. Here's what I used (and works pretty well, I should add):
$procid = Get-Process | Where-Object {$_.ProcessName -eq 'w3wp'} | Select-Object ProcessName,Id
New-Item -Path "c:\temp\Dumps" -Type directory -Force
cmd.exe /c "c:\temp\procdump64.exe" $procid.id -accepteula -mp "c:\temp\Dumps"
Furthermore, you could use these dump files for analysis using DebugDiag too. So it's a win-win in my opinion.
PS: Theoretically, one could also get the Process ID using the Get-CimInstance cmdlet. So something like this would also work:
Get-CimInstance -Query "SELECT * from Win32_Process WHERE name LIKE 'w3wp%'"