All Questions
63 questions
0
votes
1
answer
672
views
Powershell Cannot find drive. A drive with the name ' C' does not exist
Wrote a PS script that reads a .ini file for certain parameters to copy files from folder_a to folder_b,c ..and so on. I get the dreaded "
Cannot find drive. A drive with the name ' C' does not ...
0
votes
2
answers
85
views
The term 'AFDiag.exe' is not recognized as the name of a cmdlet, function, script file, or operable program
I have a simple powershell script that executes afdiag.exe with a few parameters.
Example:
AFDiag.exe /Database:"Distributed SYS_Test" /Template:"STS-Heartbeat" /DelEF:"2024-...
0
votes
1
answer
854
views
Managing "Cannot bind argument to parameter 'Path' because it is null
I have a powershell script that will move files containing certain "key words" to the corresponding folder listed in various .csv files. While I seem to have the mechanism down to move the ...
0
votes
2
answers
71
views
How to address mutable parameters like datatime in Powershell?
We have a server that is running out of space (435Gb remaining) and we want to know when it will as new 1Gb files are created every 15 hours consistently. So, I've crafted a script where users can ...
0
votes
2
answers
140
views
How to add Double quotes to Array elements in Powershell console?
I need to display all elements of the $FileNames array in Powershell console. I am iterating in a For loop but i cant print double quotes to all Array index elements on the console. Please help.
...
0
votes
0
answers
256
views
Why is powershell script is running twice?
I have a powershell script which will execute .exe file on file change in specific directory, but when the change happens, it executes 2 times one after the other.
Can you help me?
Here's the script:
$...
0
votes
1
answer
26
views
When trying to kill some particular service through PowerShell, if I found the word @LM_CRITICAL[5310] in txt file. But its not working
I have to kill Processservice.exe service through powershell code, If I found the particular word "@LM_CRITICAL[5310]" in txt log file. I am not getting any error and its not working as ...
1
vote
0
answers
485
views
Powershell Register Scheduled task with -user switch
Here is a powershell script I was attempting to use but running into an error related to the user switch. The odd thing is it works on my test computer but not production users and I can't find the ...
0
votes
2
answers
51
views
Poweshell Function Execution gives false output
I have two functions in my powershell script
check_python which checks if python exists in my computer
is_git_repo which checks the current working dir in git repository
I have problem executing this ...
-1
votes
1
answer
7k
views
how to run .exe file using powershell?
how do i run a .exe file by writing a line in powershell if my .exe file is located in "C:\Program Files\Rainmeter" and the name of the file is Rainmeter.exe ?
im just trying to make a ...
0
votes
1
answer
50
views
How can I output to file the result from foreach?
I have this script to trim leading spaces, remove " and , from a txt file.
But I couldn't put into an output file the result
$text = Get-Content output.txt
$text -replace '["]','' -replace '[...
0
votes
2
answers
530
views
PowerShell log filename with datetime issue
I am trying to create a log filename for today date time using powershell command
$date = Get-Date
$log = "D:\NewFolder\Logs\FixService$date.log"
"Write this text to log"...
1
vote
2
answers
934
views
Powershell command to select one value
My PowerShell command is working fine as below :
PS C:\Users\username> whoami /user
USER INFORMATION
----------------
User Name SID
================ ========================================...
0
votes
2
answers
149
views
Unable to run powershell script within powershell
If i run this code it will run the file
{Write-host "Please Enter the email address of the user you want to check the permissions"
$user = Read-Host
Powershell.exe C:\Temp\Report\Reports....
0
votes
1
answer
47
views
I need to loop from one array to another new array
I'm sorting windows last logon, and I want to use only variables instead of file, in file it's easy to manipulate it but slow since it will use disk access not ram.
# lastlogon
$UserProperty = @{n=&...