Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Browsing all 6937 articles
Browse latest View live

Set DHCP Option 125 for Mitel IP Phone System

HiI have to set option 125 on our DHCP servers I do this using Netsh as shown below.  How do I do this with Powershell? As it the last part of script I'm writing to create DHCP scopes with PowerShell....

View Article


How can I expand more than one proprty collection for an object

HelloCan someone please help me with the following questionif I have an object e.g. $MyObject and it has several properties two of this are collections lets call them prop1 and prop5if I do the...

View Article


select object which is not null

Hi,Is there a way to only show the properties which has values Ex : get-wmiobject win32_bios | select *it will show the properties which does not have value. Is there any way ...we can just show only...

View Article

Excel and Powershell

I am trying to create a script that will pull specific data out of multiple worksheets in the same excel file. For example I would like to have the ability for the user to input the customer and date...

View Article

Write-Host - unwanted spaces appearing

Trying my best to ditch .bat's and adopt  .ps1's!This is simplified code that shows what is happening.I have a PowerShell function which returns some text:function test { return 'StartOfLine' }I then...

View Article


PowerShell scripts works in ISE but fails as SQL agent job.

Hi everyone.Could anyone offer my any advice on why this works when run in ISE but fails in SQL Agent job.Script is : $collection = $()foreach ($server in get-content...

View Article

Creating a table

I have a text file whose content is like the following sample:12:01            Temperature             1012:01            Weight                     150012:01            Color...

View Article

Date Formatting all over the place

Hi all I am totally new to scripting and have spent ages on writing the below. It is all working apart from the date format.When creating the .CSV files excel will convert 1/2 the dates UK and 1/2 USA...

View Article


Need a installation progress indicator in powershell

Hi,I have a powershell script, which installs different .exe and .msi files silently and it works finem but due to userexsperience i would really like a way to show the progress indicator, of the...

View Article


PowerShell output saved to file location

Hi everyone.Hoping someone could offer me some advice in regards to an issue I am stuck on.My script checks the Tempdb status , I would like the results to a .csv and also display on screen if...

View Article

unable to specify an array (range of numbers) as integer

hi friendswhere am i wrong here?PS C:\>1..10 -is [int]  false [int]$array = 1..10Cannot convert the "System.Object[]" value of type "System.Object[]" to type "System.Int32". $array = 1..10$array -as...

View Article

Power shell and batch files

Hi,I don't know anything really about power shell but wanted to see if I could get some help. I have a batch file that I created to remove and reinstall SCCM. Here is the code for the batch file.cd\cd...

View Article

Do ... while doesn't work as exspected

Hi all,I have created a small function to list arrays and select one line.I ask in the do while routine if answer is -gt arraylength.This works fine until answer 9, but answer 55 is returned.I don't...

View Article


Date range -searchquery

Hi AllI have been trying to get this to work in a script with no joy. The command works if i remove " SearchQuery {(Received -lt '$end') -and (Received -gt'$start')}" What i am trying to do is to...

View Article

-filter and where

Hi All,I am very new to powershell and it is just days I started learning it. I have some idea on batch scripting. I am confused when should I use -filter command and where(or where-object) commands....

View Article


How To Ping the Serves From List and Parse the Output to Store Selected...

Hi there!Would you be so kind to compose a PowerShell script which does the following? I am trying to do it by myself, but having really hard time with it :(1.There is a file which contains a list of...

View Article

Find Active Users & .....

Find Active Users that have "change password at next logon".     That is what I need to do.   I have this code:...

View Article


Scheduled Task via Powershell

i have a script that runs and schedules a task in "Task Scheduler". It can be scheduled all sorts of ways.... what if you don't want any type of schedule but just want it to create the task and then i...

View Article

How to remove specific rows from csv files in powershell?

Hello,The code below is removing second and last row from csv files. Do you have any suggestion how to improve this code so it will take less time to run? Now it takes almost 8 minutes to remove second...

View Article

Powershell v2. Delete or Remove Lines of Text. Regex Issue.

Hi All,First time posting and very new to PS. Please be gentle ;)I've been through so many posts today that offer Powershell examples of how to remove entire lines from a file by using line numbers....

View Article
Browsing all 6937 articles
Browse latest View live