Quantcast
Channel: Windows PowerShell forum
Browsing all 21975 articles
Browse latest View live

Handling parameters on a single line script

Hi allI have a single line of Powershell which spiders through all the sub directories of the current directory and returns a nice report giving the disk space used by each sub folder. I want to edit...

View Article


Looping to Concatenate/Append Data from Another File using Powershell

I have Details.csv file which the content as below. It is lengthy but I'm making it 4 rows with top row is header. | is delimiter EmployeeID|"name"|"address" 8004956782|"Čantona"|"Townstend Street"...

View Article


Data from simple query not passing to temp variable

I have been working on a script to gather info about a bunch of PCs and while I wrote very little of it originally, I've been tweaking it to make it run faster and to make the code less complex. This...

View Article

Where (SQL) Clause does not accept string Variable

Hi AllI have the following code below that throws an error.I want to change the display name in an excel file based on certain Batch Numbers and EmailException calling "ExecuteNonQuery" with "0"...

View Article

Delete files deep in user profile on all machines

Howdy,I have an app that occasionally needs to have its cache purged, and the cache is buried deep in users' profiles, e.g.c:\Users\USERNAME\AppData\Local\VENDOR\Temp Download...

View Article


Calling one PowerShell Script from Another

Hi,I am trying to write a PowerShell script that will call another PowerShell script when the first one finishes. Can't get it to work.1. First script downloads some folders and files from a network...

View Article

Powershell to get CPU usage report.

Hi All,I am trying to get CPU usage in multiple server. Using the script below, I am able to get the result from one server without the Serverlist mentioned in the script.$Output = "C:\Temp\Result.txt"...

View Article

Convert array to string

I get this message when I try to send an email with lots of text saved in a variable with the Array typeSend-MailMessage : Cannot convert 'System.Object[]' to the type 'System.String' required by...

View Article


Ransomware fight - make partition read only...but first want to close all...

hii have script which make my partitions read-only after backup, for deny access as ransomware defence.but have problem that many files are open and after some days I need to use chkdsk.how to close...

View Article


Trying to understand -expandProperty and objects

Lets say i would like to get-process from Ad-computerget-adcomputer is an object, so in order to return a string needed for get-process i run the following:Get-ADComputer hostname | Select-Object...

View Article

Need help running PS1 on multiple computers

Looking for some help. I have this script to fix unquoted path enumeration, but I need to run this on hundreds of PCs. Need a little help with the syntax and reporting. How can I get this to a) run...

View Article

PowerShell - Obtain parameter from SSRS report

HelloI'm using PowerShell to render SSRS reports. The report I'm trying to render has a parameter that is dependent on the value(s) selected from the first parameter. I'm trying to obtain the valid...

View Article

problems with null-valued expression error

I run my code that gathers certain parameters against multiple machines to create a report. I gather the parameters in a hashtable. Problem is when running the script against one of the machines which...

View Article


vbs script to Powershell

Hi,Is it possible to "translate" this VBScript to a PowerShell script. I'm a leek in PowerShell so I hope you can help. The VBScript is a logonscript so the first part is mapping drives and the second...

View Article

All of my about_* topics are missing from help. What gives?

I upgraded a windows 7 machine to windows 10, and $PSVersionTable reports PSVersion 5.0.10586.494. I've opened the PowerShell window as admin, and run update-help. None of the about_* help topics...

View Article


No output from remote console in localhost when used foreach with invoke-command

Hello Experts,I'm not getting any output from the below script. I'm trying to execute a foreach loop in remote computer and get the output in local machine. However, am not getting any output. Below is...

View Article

HTML email sent as raw

use the following command to send an HTML formatted (hopefully) message.Send-MailMessage -From $From -to $Recipients ` -Subject $Subject -BodyIsHtml -Body $Body ` -SmtpServer $SMTPServer -port...

View Article


merging or combining to powershell scripts

Hello Powershell Community.I have a powershell script that returns critical info about the different machines on my network. Right now in my powershell script I'm calling a text file from my desktop...

View Article

How to use Select with collections and single value variables

Hi,The goal is to retrieve properties from user accounts to export to a csv file.  Some properties are collections, like businesscategory, while others are not, like enabled, passwordLastset,...

View Article

hashtable error

When I run my script the below line throws an error:$MyArray1 = @{address = $a,filename = $filename}The red error text repeats the line, puts a squiggly after the first comma following $a and says...

View Article
Browsing all 21975 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>