Tagged Questions
0
votes
1answer
25 views
How to identify the executable path of an installed application using powershell?
I install multiple applications (.msi) on different servers, am looking for a solution to identify the installed path of an application.
In powershell i used get-wmiobject to get the installed date ...
0
votes
0answers
30 views
Running multiple batch files on different remote servers in a specific order
I have some batch files which need to be run asynchronously in following order on 6 remote servers located on same network and all servers having common username & password to login. I have put ...
0
votes
1answer
51 views
Get total size of Recycle Bin
I have a need and have not been able to find any question related to what I intend to achieve. I am trying to get a script (either PowerShell or DOS WMI) to get total size of recycle bin but where ...
0
votes
2answers
46 views
PowerShell Command run from Batch
I have this powershell command to find the whitespace in each of my Exchange databases, however I cannot get it to run via batch.
Here is the shell command confirmed working:
get-mailboxdatabase ...
0
votes
2answers
31 views
How to pass parameters of rs Utility to Powershell Script
I have a Powershell Script, say TestReports.ps1. In this file I have parameters like
SourceReportFolderName
TargetReportFolderName where the Reports need to be published in ReportServer
ReportName
...
0
votes
1answer
27 views
Powershell Script for AD Users SID
I currently use this script to obtain the SID of a user from AD. Not that each time I need an SID, I have to open the script and type the persons username in, which when I have 100's to do can be ...
0
votes
1answer
41 views
Running master script file on multiple remote servers without config changes
I have a master.bat file on Remote Server1 and I want to run it in parallel on 4 remote servers located on same network and having same username and password to login as Server1.
By googling i have ...
0
votes
3answers
57 views
Windows script to Copy X number of files from one folder to another
I am new to scripting world so might be asking some novice question but I did not find the exact code after so much googling.
My requirement is to generate a script to copy X number of files from one ...
0
votes
1answer
45 views
Is it possible to convert this powershell script to batch?
This is the script:
$devid = "*HID\VID_0EEF&PID_A001&REV_1213&Col01"
$status = devcon status $devid | Select-String "running"
if($status -eq $null) {
write-host "Enabling touch"
devcon ...
-3
votes
1answer
81 views
Powershell Script for Finding Modified Date of a file/folder
I am very new to Powershell and I was hoping I could get some help creating a script that tells me the modified date of a file. I wish I knew more about Powershell, as I feel like I am asking a lot ...
0
votes
3answers
45 views
Powershell replace - how to avoid linebreaks at 80 chars
In a batch file I need to change, within a file, all instances of ##token## (just my own placeholder) with the value of a variable from earlier in the script (%tokenvar%), and output the result to a ...
0
votes
1answer
42 views
Create silent installation using .iss
I have successfully created the .iss file inside the installer folder. But i have a problem calling it.
Command:
$Process = [Diagnostics.Process]::Start("C:\temp\Setup.exe", "/S /SMS ...
1
vote
2answers
67 views
How to sign every ocx, dll and exe file
I am using signtool to sign my files.
How to recursively search all the ocx, dll and exes in a folder and subfolder then sign them all using Command Prompt ? I want to sign only the ones developed ...
0
votes
0answers
55 views
Create Folder in Batch with random name and allow other programs to write in it
I got a Problem while writing a Batch (Or Powershell in the Future)...
My Batch has to Create a Random Folder then allow other Programs like Driverview.exe create their logfile in that Folder and in ...
-1
votes
0answers
33 views
Create folder with random name,allow other programs to write in it and copy it to a Server with pscp.exe
My batch has to create a random folder then allow other programs like Driverview.exe create their logfile in that folder and in the last step pscp.exe has to copy that randomly named folder to a ...
0
votes
1answer
27 views
create a new file structure within an old while moving old within new
So my title is a little confusing, but basically I have been handed the task of writing a script (I’m not a big scripter) to reorganize our customer files.
Currently there are a number of ...
0
votes
3answers
83 views
DOS - How to get the cmd window's height (in lines)?
I want to do a personalized "more" command where the lines are outputted page by page.
Therefore, I need to get the height of the windows in a variable, in an unit of lines.
Is there a way to do that ...
2
votes
2answers
85 views
How to call a Powershell file from a batch file
I want to call a simple Powershell script file that should return either 0 or 1 upon the ps script failure or pass respectively, from a batch file . And based upon the return value, I want to ...
3
votes
3answers
73 views
Moving All Files with a Certain Name (Sorting) WINDOWS 8
Ok, so I have a large amount of ebooks and other files that I would like to sort into folders by Author name. The way I would normally do this in Linux will not work on my Windows 8 laptop. I've been ...
0
votes
1answer
41 views
User Configuration > Windows Settings >Scripts(Logon\Logoff)
I have added a script to Logon by going to the location "User Configuration > Windows Settings >Scripts(Logon\Logoff)".
I need to write a script which should remove the remove the script that is ...
2
votes
4answers
79 views
Powershell equivalent of simple DOS command-line: “copy *.ps1 *.ps1.bak /y”
I'm still learning Powershell; and, realize it was designed to be very simple. But, I'm embarrassed to say I can't figure out a simple way to do the below dos copy command using powershell cmdlets ...
1
vote
2answers
69 views
Powershell vs Batch - Java command line
I used to launch a java tool with a batch like this :
java -classpath "./lib/JSanExport.jar;./lib/JSanRmiApiEx.jar;./lib/JSanRmiServerUx.jar" -Xms128M -Xmx768M -Dmd.command=command_VSPLA.txt ...
1
vote
1answer
48 views
How to pass parameters to batch in powershell
I have a problem with my PowerShell script. I am trying to check the emails received in my inbox. When an email arrives to the inbox, the script calls a batch file that saves some of the data of the ...
0
votes
1answer
31 views
Format-List w/ No Headers
I am looking for a way to do the same thing as Format-Table -HideTableHeaders, except with Format-List, I have looked all around... but haven't found any solutions.
Background, I am importing the ...
0
votes
2answers
51 views
How to add word to beginning of multiple files using powershell
Today I walked into my office and a couple guys were renaming hundreds and hundreds of files manually on the computer. I looked up ways to rename multiple files. I currently know how to replace a ...
-2
votes
1answer
74 views
Convert bash script into Windows script
I have the following Unix shell script. I would like to convert this into a Windows .bat file (I know I can use Cygwin instead of adapting it to a Windows environment. But Cygwin is not an option for ...
0
votes
1answer
74 views
Batch script/PowerShell advanced conditionals implementation
My question is in regards to how I should go about implementing a batch script/PowerShell cmdlet on Windows that does the following:
When a browser window is open that has the window/page title ...
0
votes
1answer
2k views
How to run a powershell script using batch file
I am trying to run this script in power shell. I have saved the below script as ps.ps1 in my desktop.
$query = "SELECT * FROM Win32_DeviceChangeEvent WHERE EventType = 2"
Register-WMIEvent -Query ...
0
votes
1answer
94 views
Launching a second Powershell script using stored credentials, from batch file & passing parameters
Following a few other suggestions I've found on this site, I've managed to get most of the way to where I want to be, but I'm stuck when it comes to passing on extra variables along the chain.
I need ...
0
votes
0answers
44 views
virtualenv still looking up global site packages on Windows
I am trying to use virtualenv and Windows and it keeps loading global site packages.
I set up the virtualenv like so:
virtualenv --no-site-packages blog1.4
I am trying to use this with Satchmo ...
0
votes
1answer
88 views
FORFILES date -after- (date calc in cmd file)
I'd like to use FORFILES in a cmd file, to act on all files after a given date thru "today". I can use something like forfiles /d +07/10/2013 /c "cmd /c echo @fname" to act on everything after ...
0
votes
2answers
72 views
Move and Manipulate files across directories - Powershell
I am trying to move a list of files from one directory to another. The catch is, When the items are moved to the new directory, I want to automatically organize them.
Ex..
I have a folder of ...
1
vote
2answers
71 views
Powershell issue creating New-Object when called from a batch file
Okay, so I use NextPVR to record some shows off the telly, and have a powershell script which converts the recorded TS file into MP4, tags the file with MetaX and then is intended to add the file to ...
0
votes
2answers
75 views
Learn error with wget command using PowerShell & Batch File
I have a power shell script that invokes a .cmd file. Here the architecture looks like
-PowerShell File Code
$arguments='/savecred /profile /user:myDomain\myuser "cmd /c C:\Users\myuser\code.cmd"'
...
0
votes
1answer
54 views
Command works if run through the command prompt but not in a script..?
I'm trying to script the installation of a number of patches using a batch file since powershell doesn't properly install the patches. The command I'm running is this:
dism /online /add-package ...
0
votes
1answer
47 views
store the output of powershell command in a variable
The following commnad:
$sun=PowerShell [DateTime]::Today.AddDays(-8).ToString('dd-MMM-yyyy')
echo %sun %
the output of the echo is
PowerShell ...
2
votes
1answer
111 views
Make batch file
I have done the commands that I want to send mail in Powershell. This is my code
powershell.exe
$user="[email protected]"
$pass=cat I:\password.txt | convertto-securestring
$mycred = new-object ...
0
votes
0answers
32 views
Query using Batch for proper print driver
I'm new to Batch & WMI so I'm not sure if this is possible. But I'm wondering if there is a way using Batch script or Powershell to pass a printer make & model i.e. HP Color LaserJet CP5225n, ...
0
votes
0answers
70 views
How can I batch duplicate a folder but only zip files within the new folder for archiving?
I am setting up a job to allow me to copy log files as a scheduled batch job on Windows boxes.
The current directory on machine A is:
Logs\ YYYYMMDD\ Logfile1.log
...
0
votes
1answer
396 views
Creating a shortcut for cmd from powershell with arguments - exception cannot save with 0 args
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("C:\Users\$user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\CheckLauncher.lnk")
...
0
votes
1answer
70 views
Count number of scripts running and wait for them to finish
I'm looking for the best way to count the number of PowerShell scripts that are currently running.
I run .ps1 scripts from windows batch files. The script I am working on now is launched when a ...
0
votes
1answer
85 views
Execute .cmd file through PowerShell with Runas Different User
I have a .cmd file that I need to invoke from a powershell file. But constraint is that I need to execute .cmd file as a different user as well as process should not prompt for authentication. I can ...
1
vote
2answers
924 views
PowerShell - Batch change files encoding To UTF-8
I'm trying to do a dead simple thing: to change files encoding from anything to UTF-8 without BOM. I found several scripts that do this and the only one that really worked for me is this one: ...
1
vote
1answer
549 views
Running PowerShell script from a batch file successful on 32 bit but fails on 64 bit
I have a powershell script (test.ps1) and I want to run this from a batch file. The batch file contains the following:
PowerShell –Command “& ‘.\test.ps1’” 001
pause
When I run the batch file ...
0
votes
1answer
251 views
Batch file call powershell pass variable to smtp $message
I have a batch file that is menu driven. Users answer two questions. Based on their answers 2 variables are created and files are transferred. After that, my batch file calls a powershell script to ...
0
votes
3answers
608 views
Run PowerShell command from command prompt (no ps1 script)
I'm looking for a way to run just a couple PowerShell commands from the command prompt. I don't want to create a script for this since it's just a couple commands I need to run and since I don't ...
1
vote
3answers
219 views
Windows batch script containing binary executable
I want to create a windows batch script, which will have a base64 encoded program included. By included I mean - the encoded program will be "hardcoded" - there should be a "function" (or a code ...
0
votes
3answers
181 views
automated scripting telnet or portqry
Need an advise on how to create an automate script to check connectivity from multiple servers to one server (DB) within Windows server environment either with telnet/portqry and also the script will ...
1
vote
1answer
81 views
PowerShelll stdout trouble
A legacy program "LegacyBuilder" runs "batch.cmd" file and then redirects its output to a file, like this.
ProcessStartInfo processStartInfo = new ProcessStartInfo("C:\\batch.cmd");
...
0
votes
1answer
67 views
Copying files and renaming files into the original folder using Powershell
I am very new to the scripting process. I've been googling my problem for over a week, and have found snippets of pieces of what I need, but I can't figure out how to put it all together.
I need ...