Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [powershell-v4.0]

The tag has no usage guidance.

0
votes
1answer
17 views

How to get the size of the file using get-itemproperty in PowerShell?

I have a file having data around 5GB. I tried to get size of the file using get-content $path2 | Measure-Object method. But its taking more time as Get-Content cmdlet is present. Is there method to ...
0
votes
0answers
43 views

Illegal Characters in Path While Installing Module

In Powershell 4, I'm attempting to install the GoogleCloud module. I use the command: Install-Module GoogleCloud It fails with: PackageManagement\Install-Package : Illegal characters in path. At C:...
0
votes
0answers
24 views

Azure Automation Runbook unable to decode the webhook request data

I am badly struck by this problem. I request you to answer or give a hint. I am running out of options. I am calling an azure runbook upon high CPU utilization via a WebHook. My problem is inside ...
0
votes
1answer
141 views

How to filter the content of Powershell script output?

I need to capture the result of MSSQL Queries in Ansible output however, there are no supported Ansible modules which help me to achieve this. As a workaround, i have written a powershell script which ...
1
vote
0answers
55 views

How do I use Power Shell to copy folders from local to remote Linux Server

I am trying to make a script that will let me update the files on the server by copying then from local. I made a bash script for this task that works on Linux, but a Power Shell script is also needed ...
1
vote
1answer
90 views

Powershell Array for Path

We are trying to break the following Path from the text file, the path is dynamic in length, i.e, it can be ABC\DSD\AAR\ARE or ABC\DSD. So we need a solution to break down the path as per the ...
1
vote
0answers
126 views

Manual PowerShell DSC module installation

I am working on servers without access to the Internet. I am uploading DSC modules to the server, E.g. AccessControlDSC. The modules are being installed in c:\Program Files\WindowsPowerShell\Modules ...
0
votes
1answer
44 views

PS-Remote shell access to a user

I am currently adding Full control to an user manually. Please see below screen shot. But this needs to be done via a PS script.I followed https://blogs.technet.microsoft.com/heyscriptingguy/2010/11/...
-1
votes
2answers
251 views

Powershell script Needd to set the state of Allow Remote Shell Access [closed]

I am looking for a script which will set the value to "Enable/Not Configured/Disable" of Allow Remote Shell Access in Gpedit via Powershell script. Below value state value should get changed to ...
0
votes
1answer
414 views

Adding the Exchange 2013 PS SnapIn using Invoke-Command not working

I've been building a Powershell Module for our helpdesk team, and ran into an issue at some point: They don't seem to have the proper access rights to add the Exchange 2013 Powershell SnapIn, and I ...
1
vote
2answers
2k views

Remote Powershell not working but test-wsman does

I need to script some routine task to execute remotly from a serverA to many hosts but a couple of them fail to execute the script. If i execute this: $cred = Get-Credential myUser Invoke-Command -...
1
vote
1answer
526 views

How to execute “-NoNewWindow” parameter in powershell v4

I have used following command for my automation task. But it is throwing exception like below, parameter set cannot be resolved Command I used: Start-Process -FilePath powershell.exe -...
3
votes
1answer
107 views

Truncating part of an LDAP DN in Powershell? (Or getting the OU from an LDAP DN.)

What's the easiest way to get the OU containing an LDAP object in PowerShell? I'm working on a script to manage some groups that I've made "dynamic" with a script, and I can get the full ...
2
votes
1answer
3k views

Howto check if a powershell command succeeded or not?

Is it possible to check if a powershell command succeeded or not? Example: Set-CASMailbox -Identity:blocks.5 -OWAMailboxPolicy "DoNotExists" caused the error: Outlook Web App mailbox policy "...
0
votes
1answer
171 views

Get-AD GroupMember from a list of users in a csv

I have a list of users in a csv file, they are the displaynames. I wrote the following but all I get back is the displayname not the memberships what is needed? $csv = Import-CSV "c:\users.csv" ...
0
votes
0answers
115 views

Powershell custom object build/display

First time posting here, but long time seeking around. Let me introduce me a lil bit, I'm a Sysadmin working in the industry since 2010(kinda still junior, I guess ;) Playing around with powershell ...
3
votes
1answer
4k views

How to access/obtain Powershell DNS Server module on 2012r2?

I'm working on a Server 2012R2 server. I want to use the comdlets like get-dnsserverresourcerecord in the dns server module for PowerShell. It is not available in the ISE or in the list of modules. ...
1
vote
1answer
746 views

how to create Automatic install user based certificate from ADCS with script

We have a certificate server from which users are able to download their certificate (User Template) from this URL: http://localhost/certsrv. I now want to create a script which will do the ...
0
votes
1answer
76 views

PowerShell Sciprt to Logon a User to Win 2008 R2 Server?

I am a PowerShell Noob so please forgive. I have a Windows ID on a Win 2008 R2 server that runs a dedicated Outlook VBA application. I have tried suggestions on how to get this userid to autologon ...
1
vote
0answers
51 views

Why is HyperV Checkpoint-VM parameter SnapshotName ignored when Powershell remoting?

Having this code in powershell: $Servers = "computer.domain.com" # Open Session $Session = New-PSSession -ComputerName $Servers # Create Daily Checkpoints. Invoke-Command -Session $Session -...
6
votes
2answers
358 views

Query Powershell Error Object Time Occured

Powershell error objects contain a lot of data but I can't seem to track down the time of occurrence for a given error. Using $Error[0] | fl -f retrieves a lot of information but none that appears to ...
3
votes
1answer
601 views

WinRM service is running but will not respond

I have an environment with 16 vms on a host. They all run Windows2008R2. At one point I had powershell remoting work on all servers but one. Then I lost contact with two more. This is annoying, to say ...
1
vote
1answer
1k views

Passing list input to Get-ADComputer

SO I wrote a script that gets some information from AD about a user and their associated computer(s). I have read online about a few of the problems people face with the Get-ADComputer cmdlet and ...
0
votes
0answers
923 views

Odd behavior using WinRM via powershell, works sometimes and other times does not

Been setting up Powershell Remoting for all of our client machines (Pushed out GPO last week) and I can Test-WSMan on pretty much all of them and I get a nice expected response. Now on one of our ...
0
votes
1answer
868 views

can't open new powershell session from one server to another

I am trying to open a powershell session from one server to another. I can open sessions to servert1/2 which have the same configuration as far as I can tell. trustedhosts are the same, same user/pw ...
1
vote
1answer
384 views

Allow user to add Snap-In in Powershell on Windows Server 2012 RC2

I have a user that is used to run Powershell scripts, triggered by the Windows task scheduler on a Windows 2012RC2 server. The scripts use specific Snap-ins, which are added at the start of the script....
0
votes
1answer
76 views

Powershell: a simple script to take a list of commands and append the same cmdlet every time [closed]

I have a list of commands I run in a script like this Some-Cmdlet -someswitch | Outfile -filepath .\somefile.txt -append Another-Cmdlet -someswitch | Out-File -filepath .\somefile.txt -append Hello-...
2
votes
1answer
542 views

powershell: how to print command to file?

I'm currently using the Out-File cmdlet, like so: PS> Some-Cmdlet -someswitch | Out-File -filepath .\somefile.txt It works great. Is there anyway that I can actually get the command line itself ...
0
votes
1answer
1k views

Powershell scripts to determine remote CPU Temperature [closed]

Is there a Powershell Script to remotely check the CPU temperature of a Domain PC. Thanks
0
votes
1answer
395 views

PowerCLI transfers a file but the copied file size is way too small. What is wrong?

I am using PowerCLI version 6 on a Windows server with 20 GB of free space. I am trying to use copy-datastoreitem with PowerCLI. It seems to work to transfer a .vmdk file from an ESXi datastore to ...
6
votes
2answers
3k views

How can I use PowerShell to enable NTFS compression, in place, on log files older than x days?

I have an application server, running Windows 2012 R2, which generates a high volume of log files, to the point that it runs the application volume out of free space on a semi-regular basis. Due to ...
3
votes
0answers
456 views

Why does Get-Winevent in parallel workflow wants to use PSRemoting?

I'm building a wrapper script for Get-Winevent to search multiple computers' event logs in parallel, using multiple search criteria. I'm contructing a XML filter for Get-Winevent, then call this ...
2
votes
1answer
1k views

Delete only files leaving empty sub-folders using powershell

C:\Temp\ifc has about 297 folders inside it with roughly 4.1 million files spread amongst them. Using a script I found elsewhere on this site, I wrote the following to delete all 'files' which are ...
2
votes
2answers
2k views

Powershell: Save CSV result to folder

This should be absuredly easy but I keep running into a brick wall. I am running a Powershell script which performs an audit of my tasks and saves the result to a CSV. I keep getting a permissions ...
1
vote
0answers
245 views

Why does svn look for cached credentials in the wrong place when run as a scheduled task?

I run a daily Powershell script via Windows Scheduler under a service account that updates a local svn working copy and commits changes. The svn client is sliksvn and is run by command line only. When ...
2
votes
0answers
1k views

Is there a way for me to safely install PowerShell 4 on SBS 2011?

I want PS4 on SBS2011 A requirement of a software our office uses is PowerShell 4. The server is Windows Small Business Server 2011. But PS4 and SBS2011 seem incompatible According to the TechNet ...
0
votes
1answer
123 views

Difference between two powershell scripts

I received a script that is supposed to scan the event logs of 4 DCs, searching the event ID 4740 (user lockout). This is script number 1. Now I thought to myself, "Why scan all the DCs when I can ...
1
vote
0answers
73 views

Repeatedly prompted to restart the computer when installing SQL Server 2008 R2 on a x64 Win 8.1 machine

I am trying to install SQL Server 2008 R2 on a Win 8.1 x64 bit machine. When running the installer, I get the Reboot Required check failing the install. I have tried rebooting, no difference. I ...
2
votes
1answer
957 views

Error denying permissions on GPO with Powershell

I was trying to find a way to set "Apply policy" to "Deny" for a certain group in several GPOs (about 50), so I was looking for a way to do it automatically, when I came across this post at an (...
3
votes
1answer
5k views

Get Computer Object Properties for the list of servers in a file

When I run Get-ADComputer cmdlet, I can view all of the single object's properties, like below. C:\PS>Get-ADComputer "Fabrikam-SRV1" -Properties * AccountExpirationDate : ...
2
votes
3answers
6k views

Powershell, have function return variable that stores it?

Is it possible to have a function return the name of the variable that stores it? i.e $a = myFunction and have the function know that it is held in $a, when $a is dynamically assigned to it in a ...
3
votes
1answer
7k views

Get AD Group Member - Different Domains

I've been tasked with exporting the members of a few AD groups to .csv which I've always done in the past using the Get-ADGroupMember command in powershell, specifying the group name, selecting the ...
1
vote
1answer
679 views

How to receive email notification of non-AD joined DHCP leases?

This answer to theCleaner's question helped me some Windows DHCP Server - get notification when a non-AD joined device gets an IP address but the answer to his question involved Quest Poweshell ...
2
votes
1answer
3k views

How to cast as ArrayList, preset data in param block, and return as ArrayList?

As I need to be able to add and remove items from an array I need to cast it as an ArrayList as opposed to the more common options ([string[]], [Array], $Var=@()). I also need to preset it with data, ...
3
votes
1answer
515 views

new-WindowsImage stalls with 0x8007007E, can't load unattend.dll

I'm trying to convert capture a .VHDX as a .WIM file. The file in question is a syspreped Windows 7 generalized image. - I'm working on Windows 8.1 and I have the Windows ADK installed. - In ...
2
votes
1answer
1k views

How do I troubleshoot “Failed to get staged packages for package” error when attempting to remove a provisioned app from an offline Windows 8.1 image?

When I attempt to remove provisioned apps from an offline Windows 8.1 image, most of the apps I want to remove cause no problem, but attempting to remove Microsoft.Office.OneNote causes an error. The ...
9
votes
2answers
52k views

Powershell: A parameter cannot be found that matches

I am new to the Powershell world. Below is my first script $sServer = "Fully.Qualified.Computer.Name" $os = Get-WmiObject -class Win32_OperatingSystem -computername $sServer $object = New-Object –...
1
vote
1answer
5k views

PowerShell - Set default proxy configuration for all PS CmdLets

I can get and set proxy settings for a WebClient object and make outbound calls. I can also supply -Proxy and -ProxyCredential to individual CmdLets, but how can I just set a global default so ...
2
votes
2answers
6k views

powershell format a value that's already a string

I have some values that I want formatted in a specific way. To be very clear, its an IP address octet and I want it in a "xxx" format. For example if I have a octet value of "20" I want to display ...
1
vote
1answer
4k views

PowerShell script generates lots of warnings in Windows Event Log

I have a - rather complex - PowerShell script running on a Windows Server 2008 R2. When executing the script in the ISE or also in the console, everything runs fine. No errors or anything else that ...