Questions tagged [powershell-v4.0]
67 questions
3
votes
1 answer
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 :
accountExpires :…

Volodymyr Molodets
- 2,424
- 9
- 36
- 52
3
votes
3 answers
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 shell?

benignadmin
- 53
- 1
- 1
- 7
3
votes
2 answers
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, but the caller of the function needs the ability…

Colyn1337
- 2,397
- 2
- 23
- 40
3
votes
1 answer
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 CmdLets don't need the extra arguments?
Thanks
Luke

Luke Puplett
- 939
- 3
- 16
- 24
3
votes
1 answer
How do I debug Powershell Desired State Configuration not generating MOF files?
I'm following the most basic example on MSDN and I'm failing to get it to work. I've got my configuration defined as follows:
Configuration MyWebConfig
{
Param($ComputerName)
Node $ComputerName {
WindowsFeature MyRoleExample
{
…

skolima
- 1,263
- 3
- 16
- 28
2
votes
1 answer
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 distinguished name with the below:
$PseudoDynamicGroupDN =…

HopelessN00b
- 53,795
- 33
- 135
- 209
2
votes
1 answer
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 the least. Every time I come back to the fact…

Albert
- 133
- 6
2
votes
1 answer
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 to print to the same file before the output?
In other…

Daniel
- 1,614
- 9
- 29
- 47
2
votes
2 answers
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 fault though and I can not figure out what I am…

Matthew Crews
- 123
- 1
- 4
2
votes
0 answers
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 Wiki entry How to Install Windows PowerShell 4.0…

Reece
- 783
- 2
- 13
- 32
2
votes
1 answer
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 (aparently) abandoned blog with the following…

curropar
- 631
- 3
- 18
2
votes
1 answer
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 following PowerShell code demonstrates the…

Jay Michaud
- 3,973
- 4
- 23
- 36
2
votes
2 answers
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 it as "020" not "20".
I'm ultimately going to have…

Eric C. Singer
- 2,329
- 16
- 17
2
votes
1 answer
Is there a way to generate differences when a server is out of sync with DSC Configuration?
The following command can be used to determine if there has been configuration drift on a system:
Test-DscConfiguration –CimSession $session
The command only returns true or false. Is there a way to retrieve a list of what those differences are?

Brettski
- 942
- 3
- 20
- 31
1
vote
0 answers
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 as my machine at work is running Windows…

Pedro Henrique
- 111
- 3