Questions tagged [powershell-3.0]

Microsoft’s command-line scripting language. V 3.0, which was introduced in Windows 8 and Server 2012, supports code autocompletion (IntelliSense). Remote sessions are more reliable, and there is a bigger selection of cmdlets and built-in functions.

Filter by
Sorted by
Tagged with
1 vote
1 answer
373 views

validate particular column and its value using powershell

Validate Status Column using powershell. If any status column contain Not-compliant then overall status column needs to be displayed not-compliant. Attached data for your reference. Trying below code ...
Suraj Kumar's user avatar
0 votes
1 answer
236 views

Export data to excel by creating instance of the Excel.Application object in PowerShell

Currently i'm using ImportExcel module to fetch data from multiple csv file and export in single excel file. But due to network restriction from this month I am not able to install importexcel module. ...
Suraj Kumar's user avatar
1 vote
1 answer
707 views

Copy files and only the parent folder the file resides

Copying files but not all the folders, just the one parent/relative folder in which contains the files. Folder and Files structure: ExcelData (Folder) a. File1.xlsx b. File2.xlsx c. File3.xlsx d. ...
Suraj Kumar's user avatar
2 votes
1 answer
2k views

Powershell script to capture Screenshot

Don't want to use third party tool and module. $ie = New-Object -ComObject InternetExplorer.Application $ie.Visible = $true $ie.Navigate("https://www.google.com") $ie.FullScreen = $true ...
Suraj Kumar's user avatar
0 votes
1 answer
107 views

Exception calling "CopyFolder" with "4" argument(s): "The 'destUrl' argument is invalid."

I'm trying to copy local drive folder to targeted folder in online one drive but getting above error. Below is the code tried: - #Load SharePoint CSOM Assemblies Add-Type -Path "C:\Program Files\...
Suraj Kumar's user avatar
0 votes
1 answer
185 views

Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error message

I am running below script on my system to perform all sccm client actions trigger and getting below error. Run-SCCMClientAction : Connecting to remote server DD4 failed with the following error ...
Suraj's user avatar
  • 25
1 vote
1 answer
854 views

Export-CSV column/row value as filename

I've got a bunch of csv files that each look like this: DD-L-1_test.jaun.Csv Parameter, Version, Status OS, 21H2, Compliant Chrome, 107.1.1, Compliant DD-L-2_test.smith.Csv Parameter, Version, Status ...
Suraj's user avatar
  • 25
0 votes
1 answer
515 views

Form with Input Window, where a mechanism shall check if data has been entered

I need it to not close when user press enter or exit so that it mandate for user to make entry for all three box. I am new to powershell so I might be sounding akward but I can't find a good solution ...
Sagar Mahto's user avatar
0 votes
1 answer
30 views

Values from CSV instead of manual values

Question: This Powershell code have manual values defined "Value 1 & value 2" , want these two to be from CSV file. #Value 1 $blockedConnector1 = [pscustomobject]@{ id = ...
Varun's user avatar
  • 1
0 votes
0 answers
1k views

uninstalling the chrome using powershell script

I am trying to uninstall google chrome using powershell script but it shows me a popup to choose uninstall/cancel. How can i supress this by choosing uninstall button? Set-Location 'path\to\my\chrome' ...
ven's user avatar
  • 1
0 votes
3 answers
3k views

netstat filtering logic include/exclude in PowerShell

Currently, we use some logic in PowerShell to do a netstat -ano to get all TCP and UDP results and filter out results that we don't need to see then export it into a CSV. We want the results to only ...
Cory's user avatar
  • 13
1 vote
1 answer
856 views

PowerShell - parse beginning characters out of filenames, so they can be compared properly

Sample of file names in our naming convention using PowerShell: SYSTEM_20201019-01_PRE folder SYSTEM_20201118_file1.txt SYSTEM_20201118_file2.csv SYSTEM_20201118_file3_and_file4.txt SYSTEM_20201019-...
Cory's user avatar
  • 13
3 votes
1 answer
789 views

How to get list of CLSIDs along with their associated COM Object names?

Searching for the ways to generate or get the list of CLSIDs, I found this link, that actually does it. But it's rather incomplete in my opinion, the complete list would include CLSIDs with their ...
Vicky Dev's user avatar
  • 452
3 votes
2 answers
2k views

issue with robocopy on copying files from source to destination of longpath

I am using robocopy $source $destination /MIR, the thing is it does copy files in sync with the source but skippnig the files and directories from source which are having long path names. i would ...
E PSVP LIFE's user avatar
0 votes
1 answer
697 views

Powershell File Creation - Date Created Weird

Creating a script for work, and they want the logs to roll over for 7 days. For example, todays log is xxxxx.log, and tomorrow that will get renamed to xxxxx.01 and the next day xxxxx.02. Something ...
Freddyg103's user avatar
0 votes
1 answer
1k views

Pick up 2 file extensions in a directory using FileSystemWatcher

I am looking to pick up only pdf and rtf files but I get a result of "true" when echoing the variable $watcher = New-Object System.IO.FileSystemWatcher Write-Host "First line of the script, getting ...
mdr's user avatar
  • 1
-1 votes
1 answer
51 views

How to add SAMAccount to results?

Stuck on how to add SAMAccounts (AD usernames) to the results, can anyone help? Get-Mailbox -ResultSize Unlimited | Get-MailboxPermission | where {$_.user.tostring() -ne "NT AUTHORITY\SELF" -and $_....
Top's user avatar
  • 11
1 vote
0 answers
130 views

PowerShell always launches as administrator

I have inherited a legacy Citrix 6.5 system running on Windows Server 2008. Yes I know this stack isn't for server questions but my feeling is that this workstation question as the server is used for ...
munrobasher's user avatar
1 vote
0 answers
49 views

Moving an event log source is not having an effect

I'm having an issue that to be clear I'll describe in steps: I created an event source called Foo in the event log called Application using the following powershell command: New-EventLog -source Foo -...
rsalfonso's user avatar
3 votes
1 answer
8k views

Powershell to set default browser

I created a process using PowerShell to install Chrome. What I am looking to do now is to have PowerShell change the registry for the computer and change the default browser to Chrome. I would ...
Alcyeonnero's user avatar
1 vote
0 answers
338 views

Windows Server 2012 prevent remote desktop account logging out after inactivity

I've got a process that is running from Powershell on an Windows Server 2012 instance in AWS, however it is currently running under a user's account. The issue is that once the remote desktop ...
GoatInTheMachine's user avatar
1 vote
1 answer
2k views

Prompting for a user input to be used on a Powershell command?

I'm trying to execute the code below and it is working: PS C:\> Rename-Computer -NewName TEST -DomainCredential okadamanila\itservices Given that hostname is given on the PS1 file - however, I ...
Ruther Melchor's user avatar
2 votes
2 answers
3k views

Using powershell as default interpreter on Windows 10's SSHD?

When using the default Windows 10 sshd (SSH serv[er|ice] / daemon), how does one set it to login with powershell instead of cmd?
ylluminate's user avatar
  • 1,159
2 votes
1 answer
1k views

Can't start PowerShell 3.0 on windows 10

I'm having a very strange issue where powershell seems to hang on startup, but only on version 3: C:\WINDOWS\system32>powershell -version 2.0 Windows PowerShell Copyright (C) 2009 Microsoft ...
elRobbo's user avatar
  • 131
3 votes
2 answers
7k views

What is psprovider in powershell?

I am new to PowerShell and trying to understand the concept of psprovider. I know I can use Get-PSProvider to show a list of available psproviders All of the help I am finding, assumes I know things ...
James Jenkins's user avatar
0 votes
1 answer
2k views

Powershell Get Computer Names who are connected to the Home Directory

In AD we have Home Directory setup, and it points to a File Server which the folder it their [username]. I would like to know who is connect to those Home Directories by Computer Name by using ...
LMZ's user avatar
  • 11
0 votes
2 answers
978 views

Version of MSI to use for SharePoint online management from PowerShell

The following KB article is a rather vague on which MSI to use in what circumstances: https://www.microsoft.com/en-gb/download/details.aspx?id=35588 There are obviously 32-bit and 64-bit versions. ...
munrobasher's user avatar
2 votes
1 answer
2k views

7z archive include directories matching regex

I would like to archive directories that match a regular-expression pattern (/[0-9]{4}/). Does 7z support this? This doesn't find matching directories: PS> 7z a -t7z C:\Users\<user>\...
Craig's user avatar
  • 899
0 votes
0 answers
86 views

Is there a way to assign an alias to the Remote-Item Cmdlet's -Force parameter?

I would like to use the Remove-Item in a similar manner to how it is used in Unix/Linux: PS> rm -r -f <the_directory> However, this syntax produces an error: Remove-Item : Parameter ...
Craig's user avatar
  • 899
3 votes
1 answer
115 views

Is Exchange User Out of Office?

Finding Users Who Have "Out Of Office" Enabled In Exchange 2010 describes how to use PowerShell to determine if a user has his/her out-of-office setting enabled. However, it requires the use of the ...
Craig's user avatar
  • 899
1 vote
2 answers
1k views

Get-CimInstance not working when run from Scheduled Task

I have a Powershell script that exports a list of all the services on my local computer using the following command: Get-CimInstance win32_service | Export-Csv $PSScriptRoot\Local\services.csv It ...
mwolfe02's user avatar
  • 455
3 votes
1 answer
2k views

"Could not open a connection to your authentication agent."

Something has happened to my Windows Powershell, so whenever I open it there is a big long pause and then it says "Could not open a connection to your authentication agent." What is an authentication ...
Moss's user avatar
  • 689
2 votes
1 answer
41 views

Azure powershell issue to create office365 accounts, powershellinternalurl error

I have been using PowerShell to create Office365 accounts for about 5 months. We use Office365 to archive email. The script I was using was working flawlessly. However for over a week or so, the ...
Arif's user avatar
  • 21
0 votes
1 answer
1k views

Script to look for specific folder names, then copy contents to destination path

I'm looking for some help with finding a script, or getting a starting point, as i'm a bit new to scripting. Basically what i'm trying to achieve is the following. A specific folder name, lets call ...
Nick Nikitkin's user avatar
36 votes
5 answers
176k views

Using make from Windows PowerShell

Under Linux, sources of projects commonly come with Makefile's. Makefiles contain directives to build these projects using the command make. I am currently forced to use Windows, and so as to be able ...
Malte Skoruppa's user avatar
2 votes
1 answer
24k views

Create a new VPN connection via Powershell

I have to create an application with PowerShell that creates a new VPN connection (adapter) to a given host, with given settings (credentials, etc...). The computers will be running Windows 7. I ...
Ob1lan's user avatar
  • 1,906
2 votes
0 answers
1k views

Does powershell use CLR?

I know that powershell was built on top of .net. So does that mean it uses CLR? If yes, does that mean CLR works as an interpreter, converting directly from *.ps1 into machine code?
Foo's user avatar
  • 269
1 vote
2 answers
2k views

Select-Object For AD Groups Only

I'm trying to setup a script to find all permission information of file shares on our network. At the moment I have a Powershell script that does this, but it includes groups, users, SID account, ...
The Woo's user avatar
  • 467
5 votes
1 answer
17k views

Is it possible to install PowerShell 3 on a Windows Server 2003 or 2003 R2?

On a Windows Server 2003 rig (which already has .NET 4 but no 4.5 on it) that is to be expired before the end of the year, I'd like to run a few PowerShell 3 scripts on a scheduled base as the scripts ...
Jeroen Wiert Pluimers's user avatar
0 votes
4 answers
23k views

Simple batch file fails on Windows Server 2012

On a Windows 2012 Server, from a logged-in Administrator (local and domain), created a batch file "test.bat" by redirecting console input into a file: echo Hello When run from PowerShell cmd prompt ...
user340089's user avatar
0 votes
1 answer
2k views

PowerShell Get ACL For Folders In A Text File

I have a text file with the exact paths of the folders that I want to get permission information from, and I am trying to use PowerShell to get the information from each folder. I want to add the ...
The Woo's user avatar
  • 467
0 votes
1 answer
998 views

Powershell Get File Shares Into Array

I am trying to get a list of folders shared on a file server, and put them into an array. This is the code I have at the moment: $FileServer = "ServerName" [array]$FileServerShares = gwmi ...
The Woo's user avatar
  • 467
27 votes
11 answers
215k views

PowerShell Get List Of Folders Shared

I am trying to get a list of folders that are shared on a file share. At the moment I have two test folders: \\MYPC\Test1 \\MYPC\Test2 This is the code I have at the moment: $FileServer = Read-...
The Woo's user avatar
  • 467
0 votes
1 answer
704 views

Get-ChildItem Returns No Files Through Remoting but Works Correctly When Logged In Interactively on Remote System

I have just started working with the remoting features of PowerShell 3.0. My current problem is that I can log in to remote machine "secondmachine" and execute the command gci "\\thirdmachine\share"...
John Saunders's user avatar
4 votes
0 answers
4k views

Changing current culture

I need to change the current culture for a script and nothing I tried works. I've tried using the Set-Culture cmdlet. I've trued setting [System.Threading.Thread]::CurrentThread.CurrentCulture. Is ...
Paulo Morgado's user avatar
3 votes
2 answers
620 views

Recall PowerShell command for edit

I know about the Invoke-History command (alias r) to recall and execute a previous command, e.g. r 29 but is there a way to recall command 29 but not execute it, i.e. put it into the current line you ...
munrobasher's user avatar
3 votes
3 answers
9k views

How to run a PowerShell script from a console window when there is Å, Ä or Ö in the search path?

When I right click on a script.ps1 file and select "Run with PowerShell", a PS console window comes up, and my script can't run for some reason. So I get an error, but I can't actually read ...
Samir's user avatar
  • 20.8k
3 votes
1 answer
5k views

Unable to SSH to my virtual machine via Windows Power Shell ISE

I have a Linux VM guest running in my vmWare host that I want to access using Windows PowerShell ISE. I normally can SSH to my VM, but I cannot with Windows PowerShell ISE. When I try to do SSH to my ...
Sri Harsha Kappala's user avatar
1 vote
1 answer
20k views

get-vm - wasn't recognized as name of cmdlet

We are trying to write a powershell script to start/stop our vms, but the get-vm command isn't working. The error message is get-vm: the term 'get-vm' is not recognized as the name of a cmdlet, ...
Michele's user avatar
  • 190
0 votes
2 answers
2k views

Why does running Powershell script line by line work, but the same thru executing script file - does not?

In Windows 7 Prof, executing in Windows Powershell_ISE (as administrator) the Powershell (ver. 3) commands produces expected result (of adding a domain user to local/machine Administrators group) but ...
Fulproof's user avatar
  • 101