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.
75
questions
0
votes
0
answers
319
views
Upgrade powershell version 2.0 to version 4.0+ using cmd or powershell
I have a problem, I work in a large organization we have several computers with windows 7 and many of them are very old versions, and come with a powershell 2.0.
I was creating some scripts to solve ...
4
votes
1
answer
321
views
Don't want to display WARNING: ACTIONS REQUIRED: while running powershell script
I have written bitlocker code to backup key after old key has been shared with user.
My requirement is that don't want to display WARNING: ACTIONS REQUIRED: while running script
$BLV = Get-...
1
vote
1
answer
382
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 ...
0
votes
1
answer
246
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
715
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. ...
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
...
0
votes
1
answer
109
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
1
answer
189
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 ...
1
vote
1
answer
861
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
...
0
votes
1
answer
522
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 ...
0
votes
1
answer
1k
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
5k
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
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' ...
0
votes
1
answer
238
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, ...
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 ...
0
votes
1
answer
2k
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 "$...
0
votes
1
answer
2k
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
42
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
votes
1
answer
514
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 ...
0
votes
1
answer
94
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
279
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
3k
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....
2
votes
2
answers
560
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
650
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 ...
1
vote
1
answer
656
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 ...
1
vote
1
answer
673
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 ...
2
votes
2
answers
60
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
9k
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-...
2
votes
0
answers
4k
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
170
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 ...
1
vote
1
answer
10k
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 ...
5
votes
2
answers
3k
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:/...
3
votes
2
answers
21k
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 ...
0
votes
1
answer
6k
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-...
5
votes
1
answer
18k
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 ...
2
votes
0
answers
277
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
79k
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 ...
2
votes
1
answer
4k
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 ...
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 ...
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 ...
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
284
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 ...
5
votes
3
answers
38k
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 ...
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 ...
2
votes
2
answers
78
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 -...
0
votes
1
answer
608
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 ...
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
8k
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)
...