Quantcast
Browsing all 122 articles
Browse latest View live

downloading a file from SharePoint Online with PowerShell

I have a requirement to download files from a sharepoint online document library using powershellI've managed to get to the point where the download should happen but no luck.I know its something to do...

View Article


The term 'AFDiag.exe' is not recognized as the name of a cmdlet, function,...

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-06-01 00:00:00";"2024-06-03...

View Article


Powershell Finally block skipped with Ctrl-C

I'm writing a monitoring script in Powershell using a Try/Finally to log a message should the script end. The script is intended to run indefinitely, so I want a way to track unintended exiting.Every...

View Article

Powershell script never stops running

I have a PS script that runs a script in a list of VMs within some subscription and gets a state of some agents and exports them on a CSV file.The problem is that the script keeps iterating in loop...

View Article

How to get latest EBS volume Id with specific tag using aws cli?

I have to query my AWS account to find latest created volume with specific tags and should have it attached to running EC2 instance. How do I achieve this using aws cli and powershell?I was using below...

View Article


"Access to the path is denied" when attempting to redirect output to a file

I'm trying to redirect console output from a TFS command to a file with the following command:witadmin listfields /collection:blahblah:8080/tfs/TPC > TFSfields.txtbut I get an error:"Access to the...

View Article

ConvertTo-JSON an array with a single item

I'm trying to create a JSON-serialized array. When that array contains only one item I get a string, not an array of strings (in JSON).Multiple Items (works as expected):PS C:\> @("one", "two") |...

View Article

Error: does not contain a method named op_addition

I'm trying to remove everyone's Chrome cache directory with the following script but it keeps failing on this ridiculous error that makes no sense at all.method invocation failed because...

View Article


How can I extract "Path to executable" of all services with PowerShell

Get-Service *sql* | sort DisplayName | out-file c:/servicelist.txtI have a one line PowerShell script to extract list of all services running on my local machine, now, in addition to displaying...

View Article


Powershell - Why is Using Invoke-WebRequest Much Slower Than a Browser Download?

I use Powershell's Invoke-WebRequest method to download a file from Amazon S3 to my Windows EC2 instance.If I download the file using Chrome, I am able to download a 200 MB file in 5 seconds. The same...

View Article

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 exist."I...

View Article

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 - General"' is...

View Article

Delete files older than 15 days using PowerShell

I would like to delete only the files that were created more than 15 days ago in a particular folder. How could I do this using PowerShell?

View Article


Running PowerShell script in all Azure subscriptions

I have a reference script below from (stackoverflow) which will fetch the storage account container details. it will output the subscription, storageaccount, container name and RG...

View Article

How to use one PS dataset in a WHERE-OBJECT of another dataset

I have been using PS for about 10 years. Today I am stuck with finding a solution to a problem where I want to have items used in a WHERE-Object loaded from a SQL table. From what I have read, I need...

View Article


Powershell html Fetch / Scrape class

I am trying to fetch from this site. I am trying to fetch the first show in the list and output it to text.So far I tried this, but not able get success. any feedback would be helpful. $hsg =...

View Article

How to loop through all video files (kind:video) regardless of what extension...

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...

View Article


Using data within a SQL table to build a WHERE-Object condition

I have been using PS for about 8-9 years. I want to use a SQL table to store a list of values to use in an exclusion WHERE Object clause. The source data is NOT in SQL. It is coming from a data set...

View Article

Easier way to parse 'query user' in PowerShell (or quser)

I currently have the following query in PowerShell:query user /server:$serverWhich returns output:USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME svc_chthost 2 Disc 1:05 8/16/2016 12:01 PM...

View Article

error with SQL connection during installing MSI package with PowerShell script

I am trying to write a script in powershell that will install 10 servers on virual machines. It's just simple script where I'm specifying list of arguments, path of MSI package and run passive...

View Article
Browsing all 122 articles
Browse latest View live