Most voted "powershell" questions
The use of the tag must be related to problems with Microsoft Windows Powershell script programming which is a powerful and modern Windows command "prompt", aimed at automation and maintenance of systems by administrators.
Learn more…102 questions
Sort by count of
-
45
votes6
answers109646
viewsWhat does the error "Script execution disabled on this system" mean?
I was testing some things from PowerShell ISE so you can build some scripts. I realized that while I was running the script without saving the file, the commands were executed normally. However,…
-
20
votes3
answers25651
viewsWhat is the equivalent of the grep command in Windows?
Under Linux, when I want to filter by a term when a command will generate giant list, I use the command grep. For example: ls | grep "termo" However, in Windows there is no command grep. What would…
-
10
votes4
answers23430
viewsHow to treat accentuation in. bat files?
good morning! I’m having a hard time copying a file from one folder to another via the copy command. I’m using the Encoding UTF-8, but the cmd can’t handle the accentuation for the line below: copy…
-
9
votes3
answers763
viewsHow to list the results of a regex search in a directory?
I have a directory with some C#files. In these files there are several SQL query codes. I need to list all SELECT commands in these files using Powershell. The commands start with SELECT and end…
-
9
votes1
answer16141
viewsCMD, Powershell, Bash - What’s the difference?
There are differences between them, which? I’m talking about Ubuntu’s Bash. I’m curious because to me they seem to do the same thing!
-
6
votes3
answers2223
viewsHow to delete files from a recursively expression-based folder?
I’m using a project where there are several temporary files that, for some reason, have not been deleted over time and that are taking up a lot of space. I need to delete all images from this…
-
4
votes3
answers442
viewsPowershell - How to create a sub-site in Sharepoint Online
I have a website and I need to create sub-sites dynamically because they are many customers and I tried to use powershell for this, but I can only create a Collection site. Example: new-SPOSite -url…
-
4
votes3
answers8265
viewsBatch rename files using Windows Power Shell
How to rename all files in a folder whose name is a number (integer) followed by a certain extension (my choice) using Windows Power Shell? Example: The folder as is: 1.txt 2.txt 7.txt arquivo.html…
powershellasked 9 years, 6 months ago Ricardo 14,521 -
4
votes1
answer1307
viewsRename all files in a folder to random names
I need a command to rename all the files in a folder to a random name, which keep the same file extension and preferably with numbers, what I got so far was this: forfiles /P c:\teste\ /c "cmd /c…
-
4
votes1
answer490
viewsCheck the integrity of batch video files
How to check automatically and customizable via Shell/Programming Language the integrity (file Incomplete/Corrupted) of video files (.avi, .mp4, .mkv among others) ? OBS: Having as limiting factor…
-
4
votes3
answers647
viewsCopy file to Clipboard using Powershell
What command should I use through Powershell to send a file to Clipboard? I’ve tried this command: "C: Teste.text" | Set-Clipboard But this command copies the text "C: Test.text" and not the file to…
-
4
votes1
answer578
viewsHandle services with powershell
I created a script to start and stop a service. My intention is to be able to start or stop a service by simply clicking on a desktop shortcut. I created a shortcut for the script and in the…
-
4
votes2
answers4989
viewsHow to run scripts in powershell
I have an extract.sh script that does some things. I have another powershell.sh script that makes the powershell call only. And inside the powershell.sh I pull the extract.sh to run the script…
-
4
votes2
answers6606
viewsAutomatic installation script without user interaction
I need to run the ocsinventory agent installation automatically via script, which will be started by the domain’s GPO, and can be in . bat, . vbs or powershell, and there can be no user interaction.…
-
3
votes1
answer999
viewsWorking with directory with special characters
I have the following script: $ExistPath = Test-Path -PathType container C:\Publicação\SQL-Release\Services if ($ExistPath) { Write-Host "Removendo diretorio!" Remove-Item -Path…
powershellasked 8 years ago Rodolpho Sa 482 -
3
votes1
answer551
viewsOpen multiple programs on different desktop using script in windows 10
I’m wanting to open some programs on different work screens that I have to use frequently. And I was wondering how do I make a script to automate this. I made a simple little script. bat to make it…
-
3
votes1
answer1635
viewsCompressing Files in Powershell
How can I create a Powershell script to compress files from a specific folder?
powershellasked 7 years, 4 months ago Leonardo Bressan 170 -
3
votes3
answers528
viewsHow to deactivate CTRL+C in batch?
You can deactivate the CTRL+C command in batch?
-
3
votes1
answer73
viewsGet-Nettcpconnection bring the event Count
How can I count the amount of return using this powershell parameter? In cmd I can execute the command below: C:\Users\admin>netstat -ano |find "8000" TCP 0.0.0.0:8000 0.0.0.0:0 LISTENING 14112…
powershellasked 5 years, 5 months ago Leandro de Matos 61 -
3
votes2
answers476
viewsTranslating copy command from CMD to Powershell Copy-Item
I’m trying to translate a command from cmd to the powershell but I’m not getting it. I get multiple.txt files during the month, put them all in the same folder, some have specific terms in the name…
-
3
votes2
answers168
viewsI need to compress several separate files with powershell
I need to assemble a script to compress log files one by one, I arrived on that line, it calls the 7zip, lists the files, but returns "The system cannot find the file specified." where the folder is…
-
3
votes1
answer138
viewsHow to evaluate whether a string is present in an array in Powershell?
I’m writing a git hook to check if the commit message matches an array of words. $array = @('Adiciona', 'Altera', 'Corrige', 'Refatora', 'Remove') $msg = "Coloca coisas ao projeto." if…
powershellasked 4 years, 11 months ago João Antonio Santana 31 -
2
votes2
answers4410
viewsrun script with admin permission
I have the following code snippet: foreach($File in $(Get-ChildItem -Path $FromPath)){ $ObjFolder.CopyHere($File.fullname, $CopyOptions); } it copies the files to the windows folder, however users…
-
2
votes1
answer406
viewsError starting Powershell on Windows Server 2008 R2. How to resolve?
I have installed SQL Server 2014. When starting Powershell in Windows Server 2008 R2 and I do the command "sqlps" to test, happens this error that shows in the image below... NOTE: On another…
-
2
votes4
answers1228
viewsAlternative to sed with Powershell
On UNIX I would do something like this: sed -n '/início/,/fim/ p' < arquivo.txt In Windows we have Powershell, how do you do it with it?
-
2
votes1
answer38
viewsApropos for the Powershell
In Windows there is some solution in Powershell that can present some result of searching for similar commands to apropos unix?…
-
2
votes1
answer517
viewsError running . jar on Windows Powershell with Maven
Good afternoon to all. I am trying to run this tool (CPA - https://github.com/CityPulse/cpa). Through the link provided, I download the classes. After that, I run Maven, which generates a .jar. The…
-
2
votes1
answer147
viewsChocolatey in Windows Powershell
I’m trying to use native windows Powershell commands to install Chocolatey packages but when I use a command like Get-ChocolateyVersion get the error message: C: Program Files Windowspowershell…
-
2
votes2
answers138
viewsHow to make an input redirect (equivalent to "<" on Linux) with Powershell?
On Linux, when we want to do an output redirect, we use the symbol >. echo "Olá mundo" > Hello.txt I did the above test on Powershell and got the same result. It turns out that when I needed…
powershellasked 7 years ago Wallace Maxters 102,340 -
2
votes1
answer202
viewsDocker-Machine create Windows 10: Powershell Problems
I’m trying to create a Docker-machine in windows 10 with the following command: Docker-machine --debug create --driver hyperv default2 full debug: https://pastebin.com/ccAeqYxL But I’m making the…
-
2
votes1
answer93
viewsProgrammatically uninstall hidden devices
Uninstall hidden devices manually: Device Manager Doors (COM and LPT View Menu → Show Hidden Devices Uninstall device (The name is no longer reserved) As you can see, I know the steps necessary to…
-
2
votes1
answer5138
viewsHow to run a powershell function by calling the file . ps1?
all right with you guys? I request a help created a function that backs up virtual machines this function receives two parameters the server name and the VM name. I need to call function by running…
-
2
votes1
answer1018
viewsHow to run more than one command in the powershell?
I have the following command of AWS Cli that runs on Windows Powershell and downloads a specific folder inside a S3 Bucket: aws s3 cp s3://rfcarga/RF73 . --recursive But I have other collections of…
powershellasked 6 years, 6 months ago Leonardo Bonetti 5,313 -
2
votes1
answer220
viewsHow to authenticate to a Firewall web page via Powershell/Selenium?
I developed several Powershell scripts to automate the configuration of machines I work on, speeding up and avoiding the heavy work of manually setting up a giant number of stations. Basically they…
-
2
votes1
answer31
viewsHow to create an alias in Powershell?
I work with projects that use different versions of Node and want to create an alias for versions in Powershell. Ex: nvm-version-default nvm use 14.17.3 nvm-version-oldProject nvm use 12.20.0…
powershellasked 3 years, 10 months ago Emerson Oliveira 31 -
2
votes1
answer724
viewsReplace space with new powershell line
How is it possible to run a file . bat that runs powershell to replace spaces with a new line? I currently have this scenario in the file run.bat: set id=1 powershell "(gc %id%_01.txt) -replace…
-
2
votes1
answer49
viewsPowershell Problems with Character [
Good afternoon, I’m using the following script on powershell to copy files from one folder to another: Function CopyFiles { Param ($folderSource, $folderDestiny) $allFilesSource = Get-ChildItem…
powershellasked 4 years, 8 months ago Maykon Luiz Matos Araujo 71 -
2
votes1
answer133
viewsHow to remove part of the name of all files in a folder via CMD/Powershell
I need to standardize the name of all the files in a folder, considering that the files already have a pattern at the beginning of their name up to the 8th character, being only necessary to demote…
-
2
votes1
answer1106
viewsError in executing expo commands in powershell
I’m taking a chance on React Native and it turns out that when I try to execute the command expo init, or even expo --version through Powershell is giving the following error: expo : O arquivo…
-
1
votes2
answers182
viewsHow to hide fields from the Sharepoint 2013 user list?
How to hide fields from the Sharepoint 2013 user list? I need to hide fields in the display mode on the userdisp.aspx page
powershellasked 11 years, 3 months ago Julio 21 -
1
votes1
answer1438
viewsRemoving files for period of time
I am with script to remove file leaving only the last ones defined on time Script: $Now = Get-Date $Days = 30 $TargetFolder = "C:\LOG" $Extension = "*.*" $LastWrite = $Now.AddDays(-$Days) $Files =…
powershellasked 10 years, 6 months ago Jucimário Santana 21 -
1
votes0
answers308
viewsPowershell command to list members
Someone has already come across this situation, power shell command to list AD members connected to shared printer in each sector.
powershellasked 10 years ago JR1 11 -
1
votes1
answer28
viewsDetermine the index of a numerical character
How can I store the position of the first numeric character of a string? Example: $NomeEstacao = "Atendimento05" # posição 11 (carácter 0) $NomeEstacao = "Direcao46" # posição 7 (carácter 4) I tried…
powershellasked 9 years, 6 months ago Adriano.Paganotto 23 -
1
votes0
answers194
viewspowershell script for offline office key decryption
I removed from a PC "dead" the key from office 2007 that was in the register Now he was modifying the popular " Search-Registrykeyvalues " script to directly pass the decryption value. But I’m not…
-
1
votes1
answer3307
viewsReplace strings from filenames with Windows Powershell
How to replace strings from batch file names using Windows PowerShell? Ex: Replace the " " character with the "_" of all files in a folder.
powershellasked 9 years, 5 months ago Ricardo 14,521 -
1
votes1
answer213
viewsGet-Childitem -Recurse does not recursively return
I am trying to create a powershell script to manipulate the files in a directory, but when using the parameter -Recurse I haven’t been getting the sub-folders items # onde $source = C:\Files # e…
powershellasked 9 years, 7 months ago Tafarel Chicotti 2,715 -
1
votes2
answers171
viewsI cannot display the modification date of a directory with powershell
Hello, I am trying to display the date of creation and modification of a directory using the powershell, I am using the command: Get-WmiObject Win32_Directory -filter 'Drive="C:" and Path="\\"'…
-
1
votes1
answer628
viewsRename files in Powershell based on destination folder
I have the way A and fate B. This destination is repeated for several clients as the structure below shows: A -->app.exe -->server.ini -->js.png. B-Cliente 01 -->app_cliente01.exe…
powershellasked 9 years, 5 months ago Sergio Souza 11 -
1
votes1
answer309
viewsShell Script - Refresh page every 5 minutes
I need to update a web page (e.g., www.google.com) every 5 seconds because I have no idea how to do this script. someone can help me ? thank you
-
1
votes0
answers84
viewsCreating Active Directory users using Forms
I am creating a form for a user to be created in AD with the fields concerned, but right now you are giving me the following error: New-Aduser : The server is not available to process the request At…