Questions tagged [powershell-5.0]

For issues relating to Windows PowerShell, version 5.0

Version 5.0 of Windows PowerShell, Microsoft's task automation and configuration management platform that functions as an interactive command shell and a scripting language. For general information about Windows PowerShell, see the tag wiki for the tag.

Windows PowerShell 5.0 is available as part of the Windows Management Framework (WMF) 5.0.

For the latest news and developments, check out the PowerShell blog.

909 questions
-1
votes
1 answer

Create PowerShell aliases for Python 3.10 and Python 3.9

is it possible to set a permanent alias in PowerShell so that I can distinguish between the python versions? I would imagine it to work something like this: python310 --version would yield 3.10.0 and python39 --version would give me Python 3.9.8.…
GBoGH
  • 79
  • 3
  • 8
-1
votes
2 answers

Get-aduser by array employeenumber

I'm trying to get the SamAccountName or Name attribute of AD users given by a fixed list of EmployeeNumbers attribute, for which I made an Array, then I want to print all of the SamAccountName attributes on screen to copy them to a web…
Salvador
  • 3
  • 3
-1
votes
1 answer

Generate a file outside a time interval with date

I'm currently developing a program which is continuously running to create files outside a certain time range. Which means if the current time is outside the starttime and endtime, the file needs to be created. Here is my code: $a = get-date -format…
user2851376
  • 173
  • 3
  • 11
-1
votes
1 answer

Parsing NPING with powershell

I'm not sure how to start here, but I'd like to parse the output of nping with powershell. To handle the hosts that did send a response or syn/ack packet, hostname that was resolved, and the statistics such as sent/rcvd. Maybe into a formatted…
skrap3e
  • 143
  • 1
  • 1
  • 8
-1
votes
1 answer

Upload Attachment to ServiceNow using SOAP and Base64 via BluePrism

I am trying to upload a file into ServiceNow using the WSDL I am converting the file to Base64 using Powershell. The upload via SOAPUI works fine, however the same file when downloaded is…
NottyHead
  • 181
  • 4
  • 18
-1
votes
1 answer

How to use powershell to quickly create an archive of specific files and directories and maintain strucuture

I'm using Compress-Archive as follows to create a zip file that contains 3 files and 2 directories (and all of their sub-directories) Compress-Archive -CompressionLevel Fastest -Force -DestinationPath ./My.zip -Path .\foo.ini, …
WhiskerBiscuit
  • 4,795
  • 8
  • 62
  • 100
-1
votes
1 answer

Import csv with variable name

How do i import csv files where the name is different every month. 2018-01-foo.csv 2018-01-bar.csv And a moth later 2018-02-foo.csv 2018-02-bar.csv Im trying to script a task. But the files it should import have prequels that changes every…
YilGul
  • 18
  • 4
-1
votes
1 answer

Adding empty line in powershell script creates errors

I have just encountered a very weird error: whenever I just add an empty line in a ps1 file which is otherwise working really fine, my script generates errors. Here is the setup: Because I had dependencies issues, I now have an Includes.ps1 file…
Emidee
  • 1,245
  • 1
  • 14
  • 33
-1
votes
1 answer

Array is returned instead of hashtable

I have following powershell script: $reportsFolder = $PSScriptRoot; $reportServerDbInstance = "localhost"; $dbName = "dbname"; function Execute-Query{ Param( [parameter(position=0)] $query, [parameter(position=1)] …
Dmitrij Kultasev
  • 5,447
  • 5
  • 44
  • 88
-1
votes
1 answer

mysqldump and powershell produces utf-16

When I dump my databases using mysqldump in powershell the shell is producing a UTF-16 file. How do I stop this behavior and have powershell produce a UTF-8 file (by default)? Edit: creating a UTF-16 file is causing a "--binary-mode" problem when I…
-1
votes
3 answers

How to instantiate an unknown amount of objects in Powershell?

I have a question regarding object creation in Powershell version 5. To simplify my question I am providing the exact Java code I want to functionally realize. I know, Java and Powershell have nothing in common besides being object-oriented and I…
J.Ober
  • 199
  • 2
  • 11
-1
votes
1 answer

Get a value and than use that value to compare

I am facing a problem with a PowerShell variable. My scenario is, Inside a function, I declare a variable $a, than in a switch, I get a value and store this to variable $a. Now in another switch in that function, I want to compare $a. But there $a…
Eric Ipsum
  • 723
  • 3
  • 10
  • 24
-1
votes
1 answer

Powershell: waiting for changed directory

To make it short, I want to connect to a server that is running Virtual Machines and then get a List of all installed machines, the command I use for this is: Invoke-Command -ScriptBlock {enter-pssession -ComputerName }; Invoke-Command…
Etaila
  • 218
  • 6
  • 24
-1
votes
1 answer

Powershell Import-Module SqlServer Error

I am trying to download the 'SqlServer' module, I recently upgraded Powershell from 4.0 to 5.0. I have set the execution policy to RemoteSigned. This is on a Windows 2012 R2 Server. I am getting this error. Import-Module : The specified module…
vfrank66
  • 1,318
  • 19
  • 28
-1
votes
1 answer

PowerShell AD Users

I would like to have a script that takes a txt file of AD user IDs, indicates which are "not found", provides the DisplayName property for ones that are found and exports the results to a file. Is that possible? I've tried this, but it didn't…
klhunter
  • 1
  • 2
1 2 3
60
61