1,963 questions
-1
votes
2
answers
88
views
Optimizing ps1 Script that deletes files/folders [closed]
I have here code that recusively deletes all files/folder older than 7 days within a directory. The directory is fairly large last time I ran it took about 12 hours to finish. I know that getting ...
0
votes
1
answer
247
views
Install-ADDSDomain: Verification of prerequisites for Domain Controller promotion failed. The specified argument 'ConfirmGc' was not recognized
I am trying to install a new tree domain to my forest but I get the following error:
The target server will be configured as a domain controller and restarted when this operation is complete.
Do you ...
3
votes
0
answers
71
views
Getting exception while exporting Certificate Key PEM file using Power Shell
Trying to export the Certificate Key PEM file using Power Shell but getting the exception - Exception calling "GetRSAPrivateKey" with "1" argument(s): "Key not valid for use ...
0
votes
0
answers
44
views
API returning response as 3 instead of json when we copy request from "copy as powershell" option
when i tried to copy request objects from chrome browser by "Copy as PowerShell" option , and try to paste that into PowerShell in my machine.
i am getting content in response as 3 ,instead ...
0
votes
0
answers
75
views
Unable to understand RPC_E_SERVERFAULT Error
I have a PowerShell Script that cycles through multiple Excel Workbooks, runs a few VBA routines, and then closes.
Unfortunately, I get the following error :
Exception calling "Run" with &...
3
votes
1
answer
114
views
Constructor invocation syntax in PowerShell 4.0 and lower without using New-Object
I ran across some older code today that piqued my curiosity. I'm aware of 2x different syntactical ways of instantiating .NET objects in PowerShell 4.0
# Using New-Object to pass multiple args to the ...
1
vote
3
answers
88
views
How to add single quotes to one of the columns in PowerShell?
I have the following lines in a file:
pc_cc_text$fx_review1 CONSTANT VARCHAR2(100) := 'For Company Review'; -- AD_PRT_AUTH_(MSP)
pc_cc_text$fx_review2 CONSTANT VARCHAR2(100) := 'For Dept Review'; -- ...
0
votes
1
answer
1k
views
How to get Drive Item ID of a file from a user OneDrive using PowerShell Microsoft Graph
I'm trying to get a specific file's Drive Item ID from a user's OneDrive using Microsoft Graph. The sample script below is working, but it's really slow because it has to search the entire user's ...
0
votes
1
answer
63
views
How to delete all lines AFTER and INCLUDING a certain string?
I have a need to delete all lines in a csv AFTER and INCLUDING a certain string. The string is as follows :
S_Channel_Alt_View
The file should then look like this
I've tried to set something up ...
0
votes
1
answer
110
views
I need a script for SCCM detection key to Match Value Data
/* I need a script SCCM detection key for match "Value Data" in "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" Without using "ValueName" Match "...
0
votes
2
answers
210
views
How to append the data into HTML file or HTML table using PowerShell
I am working on a health check PowerShell script that is generating an HTML file. Now, I want to update the solution where If I run the same script again (as a post check) it should create maybe ...
0
votes
0
answers
164
views
Certificate is not accessible to the current user
Receiving the above error while connecting to exchange online through system center orchestrator runbook workflow. The path given was verified and correct. The script works completely fine when we run ...
1
vote
1
answer
514
views
How to loop through all video files (kind:video) regardless of what extension those files(could be .mkv / .mp4 / .mov etc.) have?
So I know that by using this command we can loop through all the MKV / MP4 files in the current folder. But I don't want to have to Google and find out what all possible file-types or extensions the ...
0
votes
1
answer
66
views
trying to write a PowerShell script to look for certain strings in a text file
I am trying to write a PowerShell script to look for certain strings in a text file but not getting very far.,
What I want to do is:
Search line by line until "set name 'Web Traffic Filter - ...
0
votes
1
answer
148
views
When Converting excel to csv for empty cells quotes not coming
I'm trying to import excel file to csv format through power shell using this command
import-excel c:\users\xxxx\TestFile.xlsx | export-csv c:\users\xxx\CSVFile.csv -NoTypeInformation -Encoding UTF8
...
0
votes
1
answer
97
views
replace-text-in-multiple-file-using-powershell.ps1 with proper line alignment
The out put is not getting same replacement of line alignment.. but its not getting same alignment(which it should replace 3 lines. But it going zigzag replacement.. looks ugly, any help
<Hello ...
0
votes
1
answer
282
views
Event View Source Not Found When Creating an Event with Powershell
Trying to create simple events with ID's greater than 1000 to test a notification system using powershell.
Write-EventLog –LogName System –Source FailoverClustering –EntryType Error –EventID 1793 –...
0
votes
1
answer
102
views
add string as a prefix to extracted string (PowerShell)
I have a script that extract set of sha256 hash from csv and save it in txt file,
I want to add string (as a prefix) before each sha256 hash
the script:
$csvfileImport = "C:\test.csv"
$...
0
votes
1
answer
113
views
Powershell Excel Autofilter RGB Colors
I'm currently trying to enter RGB colors in the Excel Autofiter. Does anyone know how this works in Powershell?
$WorkSheet1.Range("A6:AW6").AutoFilter(1,$WorkSheet1.color.rgb(0,255,0), 8)
...
2
votes
2
answers
91
views
Powershell Custom Sorting
I have below content in a txt file which will be read by powershell and should be rearranged based on a custom condition
File: abc.txt
General
User1/Alert
User1/LogicApp
General/Abc
User2/Alert
User2/...
0
votes
1
answer
822
views
PowerShell script Error Directory Name is invalid
I am trying to invoke a power shell script using task scheduler but it gives me the error, The directory name is invalid Error (0x8007010B).
I have tried placing the script in C: and C:\users and also ...
-1
votes
2
answers
498
views
PowerShell script to export Array in CSV format with Headers
I've below PS Script which connects to API and puts responses on an Array List.
I'm struggling to convert Array List to CSV file and giving them a Column Header.
Anyone got Idea how to this can be ...
1
vote
1
answer
97
views
POWERSHELL jump Back in EXCEL COM-Object
I have a function to open a Excel sheet and one to manipulat differend cells in a excel sheet.
Now I'd like to save and close the the Excel-data.
But I pass only the Sheet object. How can I jump "...
0
votes
1
answer
113
views
Powershell Removing rows from a CSV that matches values in a Separate CSV
We are currently in the process of migrating files and at the end of each migration we need to produce a report of any file that doesn't get migrated. (Not all source files are migrated).
I produce a ...
0
votes
1
answer
56
views
Fetch all the files in a folder but exclude all the files in a sub folder by using powershell
I have a powershell script to fetch all the files in a folder but exclude all the files in a sub folder. I am using the following script, but not giving the expected results.
Get-ChildItem -Path $...
0
votes
2
answers
58
views
Objectmendername with Spaces
I have a CSV-List to replace Strings in an XML.
Now the CSV looks like:
First;Secound One; Third
Name;Beschreibung Neu;Func1
Number;handout her, func2
The Code is:
#Splatennamen auslesen
$...
0
votes
0
answers
93
views
powershell scheduled task trigger with variable
Need to make a script where the script will read the date from text file, then add the time in the variable. Use the variable in the script and make a scheduled task at remote computer.
$Reboot_Dt = ...
0
votes
2
answers
152
views
Wanting stmp old and new email address from proxyAddresses AD attribute
The following script works, but if I put an old email address that a user had it doesn't provide data. I want to show all the new and current emails address with me providing an old email address.
...
1
vote
1
answer
361
views
Passing admin credentials in Start-Process cmdlet
I am trying to build a script that installs an application with encrypted local admin credentials on the pc when the user logged in is not an admin.
I am running the below cmdlet:
$User = "admin@...
0
votes
2
answers
301
views
Unique Volume ID path of a volume seemingly corrupted while tryig to create a new junction with New-Item; How to fix, bypass or work around?
I am writing a PowerShell script where-in I create a directory junction.
During the development of the script I ran the New-Item command, saw the junction entry was created without looking closer at ...
0
votes
1
answer
85
views
Concatenation of variable not working with SQL command in PowerShell script
I am trying to get the value of a date variable into the string by concat
$Lastextracteddate=Get-ChildItem $folder |
Select-Object @{Name="LastWriteTime";
Expression={$_....
0
votes
0
answers
92
views
Powershell is not properly showing the output of my array from my hashtable
I had another question asked on this issue I'm having with Powershell. I can't get all the columns to return from an array hashtable. I'm trying to search multiple PCs for certain updates but the ...
1
vote
0
answers
189
views
Powershell "You cannot call a method on a null-valued expression"
$Results = @()
$MbxUsers = Get-EXOMailbox -resultsize unlimited
foreach($user in $MbxUsers)
{
$Mbx = Get-ExoMailboxStatistics $user
$Properties = @{
DisplayName = $user.DisplayName
...
-1
votes
1
answer
83
views
Selfoptimization ffmpeg script
I'd like to split mp3 Files at a specific range by silence.
To do that I have the following script, but don't know how to stop and restart the search function:
$minDuraton = 180
$maxDuraton = 480
$...
1
vote
1
answer
77
views
Include PS1-Data except script Itself
I have 3 scripts in the following directories:
C:\PS
Caller.ps1
C:\PS\Module
Connect.ps1
Statusbar.ps1
Caller.ps1 and Connect.ps1 contains the following code:
Set-Location $PSScriptRoot.Replace(&...
0
votes
0
answers
210
views
Setting ACL Inheritance hangs using Powershell
Looking for some assistance. I have been tasked with re-enabling Inheritance for over 60TB of data. I am using Powershell to accomplish this. The issue I am running into is when the script runs, it ...
0
votes
2
answers
71
views
How to split before exporting to csv in PowerShell
I've this simple script and I'm wondering how can I split WebUrl value, add a new column called "UserID" and add it in there.
Right now it look like this
DisplayName WebUrl
John Smit ...
0
votes
1
answer
199
views
Copy AD group members from Group A to Group B
I'm try to write an script which copy's member from "Group A" to "group B" but its failing as Group A has over 10000 members
I have use following script
Get-ADGroupMember -Identity ...
1
vote
2
answers
778
views
Powershell: Select Range with column Number
I have a Script that took the Column number($lc) and Row Number ($sr / $lr).
Now I'd like to select a Range from ($lc - 7)($sr) to ($lc)($lr).
The problem is, I don't know how to convert a Column ...
0
votes
1
answer
91
views
Powershell Select Copy Paste XML NODE
I have an XMl which I'd like to expand.
I want to select the 2. "Step" Node- > copy -> Change -Number- | -Name- and some inner-Text strings
I want to select the 2. "Transition&...
0
votes
2
answers
712
views
Powershell Import Excel Range to 2Dim Array
I have multiple Excel Files where have nearly the same structure:
Now I want to collect the Data reorganize it and save it to an single CSV.
How can I save the Range (A2:C12) to an 2dim Array?
2. ...
0
votes
1
answer
898
views
Register Scheduled Task throwing Register-ScheduledTask : The parameter is incorrect error
I modified the function to create the task taking out some unnecessary actions. Now when I try to run it I get the error below. I have tried following a couple different parameter schemes. But I can't ...
1
vote
1
answer
69
views
How to check if string Starts with an S, is alpha numeric and has a length of 8?
I'm sure there is a cleaner way to do this. I'm looking for a way to check the following when importing a csv:
String Starts with S
String is alpha numeric
Sting has a length of 8
So far I have ...
0
votes
0
answers
86
views
Use same powershell module with different instances in same script
So, I have a PowerShell module that I want to use called psPAS. Its a wrapper containing APIs for CyberArk software where we use New-PASsession (and pass the URL) to authenticate to CyberArk ...
0
votes
1
answer
51
views
New Key is not appearing in registry
I am trying to Create a Key and adding 3 dwords to it to make it easier for me to add to multiple computers. But PS is not returning any errors when running but the key and the DWORDs are not ...
0
votes
0
answers
2k
views
Hindi IME is not ready yet
We have a requirement where we want to install Hindi Keyboard with Phonetic on user remotely using a schedule task with powershell. The schedule task is run in user mode since running in system mode ...
0
votes
0
answers
61
views
How to put Array Results into a foreach collection?
I have the following code which collects fiels from various directories:
$Working_Dir1 = "$Env:ARCHIVEPATH\FDMEE\Data-$Env:_ENV\Actuals\Full_Year"
$Latest_Dir = Get-ChildItem "$...
1
vote
0
answers
73
views
PowerShell script not exiting after completion
Below is the code which I'm trying to run which installs software from machine A to B and then deletes the file from remote machine, which the installation works but cannot pass over the next piecce ...
0
votes
3
answers
181
views
Add Node to XML with Powershell4.0
Im trying to add a new XML Node to a existing XML which is a API Response. But unfortunately i cannot get it to work trying many tutorials and examples. I cannot tell you which Options i tried but the ...
-1
votes
1
answer
42
views
Sort text file containing date in powershell
I am new to powershell. I have a text file as below. I need to sort this file in powershell.
`
<!DOCTYPE html>
<html>
<head><meta name="robots" content="noindex&...