Questions tagged [powershell-2.0]

Microsoft’s command-line scripting language. V 2.0, which was introduced in Windows 7 and Server 2008, features remoting.

Filter by
Sorted by
Tagged with
0 votes
1 answer
32 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 ...
1 vote
1 answer
34 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. ...
1 vote
1 answer
35 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. ...
1 vote
1 answer
69 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 ...
0 votes
1 answer
20 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\...
0 votes
0 answers
23 views

Delete a specific Computer from Active Directory without using AD Module - PowerShell

I am running PowerShell on my own computer that is connected to the domain. I want to contact the Active Directory of my domain, check if there is an entry for this computer and if yes, delete that ...
  • 25
0 votes
0 answers
24 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 ...
  • 25
1 vote
1 answer
43 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 ...
  • 25
0 votes
1 answer
36 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 ...
-1 votes
0 answers
20 views

working with com objects in powershell

How we can export data to excel using com objects in powershell
0 votes
1 answer
305 views

powershell for diskpart utility in windows

I want to avoid using command prompt for diskpart utility but want to know if there is any alternate available in powershell for diskpart to handle windows Dynamic disks ?
0 votes
1 answer
2k views

Disable PowerShell v2 via GPO

I'm trying to disable the old v2 version of PowerShell via GPO but have not been successful. I have tried everything, to run a Scheduled Task (running a PowerShell script which command inside DOES ...
0 votes
0 answers
266 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' ...
  • 1
0 votes
1 answer
177 views

PowerShell 2 on Windows Server Core

I have two machines, Windows Server Core 2016 and Windows 10 Enterprise. From cmd, executing PowerShell.exe and then $PSVersionTable.PSVersion outputs version 5.1 for both machines. From cmd, ...
  • 101
3 votes
2 answers
1k 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 ...
0 votes
1 answer
1k views

How do I write this powershell 2.0 command, which creates a scheduled task, to run another powershell command?

For all intents and purposes, I am a novice with PS. The command I'd like to run (it works when run manually) is: (I realize parts are probably redundant) Start-Process -WindowStyle hidden "$...
  • 45
0 votes
1 answer
1k views

Power Shell Stop-Process throwa error that the process does not exist

I am trying to execute the following script $WonderwareProcess = Get-Process -Name "Studio Manager" Write-Output $WonderwareProcess Stop-Process -Name $WonderwareProcess -Force $Result = Get-Process |...
-1 votes
1 answer
39 views

I as the user, am trying to add myself to local administrator group on the box

so im working out an exercise and wanted to ask what possible avenues there were to do this (preferably through powershell v2) I have tried the following from a batch file casually written: C:\...
  • 1
-1 votes
1 answer
408 views

Struggling to get Skype to download over Powershell 2.0

I'm having difficulty with a batch file I created to aid in downloading, and updating Skype. The part that isn't working is the bit which downloads Skype itself. Most of the machines I'm supporting ...
user avatar
0 votes
1 answer
89 views

power shell + how to capture the names in file before separator to variable

in file.info we have the following structure kdme:424324 fejwde:3425 kededmrf:132456 edkmedefrf:45 . . . how to set the variable - param with all names - kdme fejwde kededmr edkmedefrf expected ...
0 votes
1 answer
223 views

power shell + match exactly the first field and capture the second field after separator

we have the following file ( files.sum ) the first field is the name of the file the second field is the seprator the thired feald is the sum configuration.txt:2327432786 config.csv:458349573 ...
1 vote
0 answers
2k views

copy file from a remote PC by means of Powershell using UNC Path

I need a way to copy file to local disk from a remote PC using Powershell v2.0, trying with admin rights of that remote PC. By means of below cmdlet we can copy a file: Copy-Item -Path C:\somefile....
  • 111
2 votes
2 answers
382 views

How can a (PowerShell) script determine it is running at startup?

I'm building a PoSh startup script that initializes a couple scheduled tasks. One task is triggered at user logon and another is triggered on idle. Both tasks run the script again. Only the first ...
-2 votes
1 answer
617 views

How and where to upload/download a file with cmd.exe/PowerShell

I wanted to download files via CMD, and the first way I discovered was FTP. I rent a server and everything worked. The problem is that it takes kinda long to type in the credentials. After some ...
  • 17
1 vote
1 answer
580 views

Why do I need to escape the last single quote in this Powershell here-string?

According to Powershell "about quoting rules": A here-string is a single-quoted or double-quoted string in which quotation marks are interpreted literally. However the following here-string ...
  • 612
1 vote
1 answer
598 views

Powershell recursive filename read and rename

i have downloaded from my ftp server a directory tree using wget and forcing ascii encoding so now i hve a lot of folders and files names something like "foo%C3%BC" (some of the files/folders already ...
  • 111
2 votes
2 answers
58 views

Trouble working with Github

In order to learn from other and better programmers how to write good code I decided to install Github Desktop. It was installed-no problem, but, on opening the Git shell that comes with the ...
2 votes
1 answer
8k views

What is the PowerShell command equivalent to selecting "Sleep" from the Win7 menu?

What PS command(s) do I use to put my lappy to sleep like the description when I hover the mouse over the Windows menu "Sleep" option: Keeps your session in memory and puts the computer in a low-...
  • 728
2 votes
0 answers
3k views

Proper Powershell 2.0 installation on Linux with wine 1.7.29

Despite the bad rating on WineHQ I attempted to install Powershell 2.0 using wine 1.7 on Debian Jessie, and after a registry "fix", it runs without the previous startup errors. I had followed the ...
0 votes
1 answer
162 views

Powershell command works from cmd but not run

I am trying to bind this command to a key (MS Keyboard Center): powershell -Command "(new-object system.Net.WebClient).DownloadFile('http://spotify.hum?command=play','test')" If I run this from an ...
  • 57.9k
1 vote
1 answer
9k views

Powershell Enter-PSSession use current credential

I want to use Windows Powershell to start up a VirtualBox VM and then Enter-PSSession to manage the machine on an automated nightly system, which means I will be asleep when this is happening and not ...
  • 485
5 votes
2 answers
2k views

Archive of Microsoft's Powershell 2.0 Documentation?

When looking up information on a specific cmdlet built into Powershell on Microsoft Technet, you can choose between version Powershell versions 3.0, 4.0, and 5.0. See this page for an example - https:/...
  • 245
3 votes
1 answer
17k views

Restart a computer at a given time with PowerShell

I'm looking for a way to restart a computer with PowerShell (Restart-Computer), at a given time (Example: 03:00AM). The PS-Script itself will run at a random time, when the user executes it, so it's ...
  • 376
0 votes
1 answer
5k views

How to unblock file via WindowsPowerShell?

I am using windows Vista buissnes 32 bit. When I try to execute command : dir *.* -Recurse | Unblock-File I am getting : The term 'Unblock-File' is not recognized as the name of cmdlet, fun.. I am ...
1 vote
1 answer
1k views

Powershell 2.0 Enter-PSSession cannot get New-PSDrive working

I have a remote computer which I can Enter-PSSession successfully. When I execute: New-PSDrive -Name "G" -PSProvider Filesystem -Root '\\fileserver\apps\etc' I get the following error: New-...
  • 11
5 votes
1 answer
17k views

How can I use PowerShell to parse filenames and rename them?

I've got a project analyzing logfiles. Someone, in their infinite wisdom, is naming the logfiles MM-DD-YYYY-HH-MM.LOG (e.g., 10-31-2012-18-00.LOG for 6:00pm on October 31, 2012). My first order of ...
  • 1,719
2 votes
0 answers
268 views

Change State of Windows Update- Local Group Policy Editor without UI?

In windows server 2012,for this manual step how can i do from script, start>run>gpedit.msc>administrative Components>Windows>Windows update In that 1) Do not Display " Install ...
12 votes
5 answers
74k views

Powershell script to list scheduled tasks on remote systems

I want to write a PowerShell script that lists all Scheduled Tasks on remote systems, and includes the user account which will be used to run each task. The local system is running Windows 7, with ...
  • 1,896
2 votes
1 answer
3k views

Windows Batch File (WMI) - taskkill process based on memory usage

Is there a way using WMIC, bat files, or powershell, to kill a task with a particular task name if the amount of virtual memory the process is using is above a certain limit? Specifically I want to ...
  • 141
0 votes
1 answer
2k views

Can't run start-process command

I'm trying to run a command found in this answer. The command is start /w %SystemRoot%\system32\pkgmgr.exe /ip /m:Windows6.1-KB2506143-x86.cab Trouble is, it doesn't work for me. Indeed, it returns ...
  • 57
0 votes
1 answer
9k views

PowerShell “.count” method causing incorrect processing

I am creating an array in PowerShell that doesn’t always contain data (sometimes it is empty). I need to verify that the array contains data before trying to do anything to the array objects. When I ...
  • 523
0 votes
1 answer
1k views

Powershell function with Parameters throwing null exception

This script is throwing a null exception and I am not certain why that is the case... Function StopServices{ Param ( $ServiceName, $Remoteserver ) write-host($...
1 vote
1 answer
240 views

PowerShell reports missing method, when method exists

I've had a problem recently with PowerShell reporting that a method does not exist on an object, while Get-Member reports that it does. This doesn't happen with all methods, but I have had it happen ...
  • 13.3k
5 votes
3 answers
37k views

How to run "winrm quickconfig" on all LAN computers remotely

I want to start doing my remote LAN work using powershell, but it seems I need to run winrm quickconfig on all LAN computers before I can remotely connect to them. How can I run that command on all ...
  • 2,140
4 votes
0 answers
1k views

How can I easily split a CSV into two Excel worksheets with PowerShell? [closed]

I recently found out that PowerShell can be used to write Excel documents. The first use I thought of for this was to (at least partially) automate parsing of some CSV reports that I regularly have to ...
  • 13.3k
2 votes
2 answers
77 views

Access the user's selection from a previous cmdlet

I'm writing a script that I want to be able to react depending on the user's answer to a confirmation prompt that is part of a cmdlet being run in the script. For example: Stop-Process -Name notepad -...
  • 13.3k
0 votes
1 answer
597 views

Cannot install Windows Powershell on Vista64

I am desperately trying to install Powershell 2.0 on my Windows Vista 64 system. I downloaded KB968930 like a hundred times but when I start it it always says that I cannot use it with my system. ...
3 votes
3 answers
2k views

How to remap shortcut in Powershell

I want to remap the shortcut in powershell, for example, I'd like to use Ctrl + a to make cursor at beginning of line, Ctrl + e to make cursor at the end of line, etc. I searched the method in Google ...
  • 1,102
2 votes
1 answer
5k views

PowerShell touch all files newer than

I have found the following question on ServerFault: Windows recursive touch command Which partially answers my question with this answer: Windows recursive touch command However, I would like to ...
2 votes
1 answer
7k views

Powershell Select-String to remove a string line from a variable if matched

I am trying to do the following: Look for a file in a folder which has been modified in the past 24 hours Find a specific section of the file Remove lines from the section matching specific string(s) ...