powershell-2.0 Questions

3

Solved

I'm looking to implement a PowerShell Provider in PowerShell. I keep thinking that if I just define the types, then import them into my session (import-module), I should be able to have them avai...
Silurid asked 22/5, 2012 at 20:21

2

Solved

When I run a below command to list log by ID, it says Get-WinEvent : No events were found that match the specified selection criteria. How can I catch this exception and display a simple message s...
Groenendael asked 31/10, 2014 at 17:12

2

Solved

I'm trying to write a piece of code to drop and re-create an MS SQL Database in PowerShell using some Invoke-Sqlcmd commands (caused by an error in our systems). I wanted to build some contingency ...
Doane asked 11/9, 2015 at 11:57

3

Solved

Is it possible to calculate a SHA-1 hash in PowerShell V2.0? The only information I can find online is with PowerShell V4.0.
Bernicebernie asked 1/12, 2014 at 15:55

4

Solved

This sounds like a simple question, but I haven't been able to work it out after looking online. I basically want to execute a PowerShell script (e.g. script.ps1) in Jenkins and report success/fail...
Allopath asked 4/5, 2012 at 16:44

9

Solved

Get-Service *sql* | sort DisplayName | out-file c:/servicelist.txt I have a one line PowerShell script to extract list of all services running on my local machine, now, in addition to displaying ...
Lori asked 27/6, 2014 at 10:2

4

Solved

I have a powershell script (setup.ps1), that we use as the entry point for our development environment setup scripts. It takes a parameter: param( [Parameter(Position=0,HelpMessage="The targets t...
Teetotaler asked 8/3, 2011 at 20:8

6

Solved

While running remoting commands like Enable-PsSession, Invoke-command etc. we need to provide credentials with those commands. I don't want to provide the credentials every time while executing t...
Claudeclaudel asked 5/8, 2013 at 8:11

5

I have a script which copies some files to a backup storage. And I added a timer to see how much time it would use doing this. I used $script:start = Get-Date $start = (Get-Date) Copy-Item $var0, ...
Varese asked 23/7, 2013 at 13:42

8

Solved

I have written a PowerShell script that will create an email, however I can't seem to attach a file. The file does exist and PowerShell can open it, Could anyone tell me what I'm doing wrong? $ol ...
Foreclosure asked 22/10, 2010 at 13:35

4

Solved

Good Afternoon Everyone, I am working with a Storage Area Network (SAN) that has approximately 10TB of data. I need to perform a recursive directory listing to identify specific types of files (e.g...
Dariusdarjeeling asked 14/4, 2013 at 11:0

23

Solved

I am distributing a PowerShell script to my team. The script is to fetch an IP address from the Vsphere client, make an mstsc connection, and log it in a shared file. The moment they used the scri...
Strew asked 13/4, 2012 at 7:54

11

Solved

I need to extract file name and extension from e.g. my.file.xlsx. I don't know the name of file or extension and there may be more dots in the name, so I need to search the string from the right an...
Outgrow asked 20/3, 2012 at 14:12

5

Solved

I have a simple requirement. I need to search a string in Word document and as result I need to get matching line / some words around in document. So far, I could successfully search a string in f...
Vernavernacular asked 27/11, 2014 at 11:1

5

Solved

How do I properly escape the quotes in the -param value in the following command line? $cmd="\\server\toto.exe -batch=B -param="sort1;parmtxt='Security ID=1234'"" Invoke-Expression $cmd This of...
Glottology asked 8/8, 2013 at 0:50

19

Solved

I'm using PowerShell 2.0 and I want to pipe out all the subdirectories of a certain path. The following command outputs all files and directories, but I can't figure out how to filter out the files...
Oleta asked 21/6, 2010 at 14:3

7

Solved

I have a very short PowerShell script that connects to a server and imports the AD module. I'd like to run the script simply by double clicking, but I'm afraid the window immediately closes after t...
Mlle asked 24/5, 2013 at 16:11

36

Solved

How do I find which Windows version I'm using? I'm using PowerShell 2.0 and tried: PS C:\> ver The term 'ver' is not recognized as the name of a cmdlet, function, script file, or operable prog...
Cronus asked 7/9, 2011 at 7:20

5

Solved

I need to know how many replacements are made by Powershell when using either the -replace operator or Replace() method. Or, if that's not possible, if it made any replacements at all. For exampl...
Grattan asked 27/2, 2010 at 0:46

6

Solved

Is there an easy way to verify all files were copied correctly when calling copy-item? I thought about using the checksum on all files, but I would imagine powershell (v2) would already have someth...
Verada asked 17/1, 2010 at 17:23

7

Solved

I get this message everytime my script doesn't end properly and stop-transcript is not executed: Start-Transcript : Transcription has already been started. Use the stop-transcr ipt command to stop...
Permeability asked 16/4, 2012 at 7:35

9

Solved

I have the following script code #[string]$password = $( Read-Host "Input password, please" ) param ( [string]$ReleaseFile = $(throw "-ReleaseFile is required"), [string]$Dest...
Spleen asked 20/12, 2013 at 15:26

5

Solved

I feel like I'm missing something that should be obvious, but I just can't figure out how to do this. I have a ps1 script that has a function defined in it. It calls the function and then tries us...
Bergquist asked 6/7, 2012 at 17:58

33

Solved

PowerShell's Get-ADGroupMember cmdlet returns members of a specific group. Is there a cmdlet or property to get all the groups that a particular user is a member of?
Vanhouten asked 22/2, 2011 at 0:57

6

Solved

When my shell starts, I load an external script that has a few functions I use to test things. Something like: # Include Service Test Tools $scriptPath = split-path -parent $MyInvocation.MyCommand...
Leopoldoleor asked 4/8, 2014 at 17:2

© 2022 - 2024 — McMap. All rights reserved.