Questions tagged [powershell-v4.0]

67 questions
15
votes
5 answers

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 restrictions from the application itself, I can't…
14
votes
1 answer

Avoid truncating error message in Powershell error

I'm getting a Powershell error like this: PS C:\mydirectory> $Error[0] Get-WmiObject : At line:143 char:13 + $Disk = Get-WmiObject MSCluster_Disk -ComputerName $Resource.OwnerNode -Auth ... + …
11
votes
2 answers

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 –TypeNamePSObject $object | Add-Member…
9
votes
3 answers

Howto initiate Windows Update on server core from a PS remote session?

When I am logged in via remote desktop on a Windows Server 2012 R2 Core machine I can trigger the windows update by running sconfig.cmd. This however fails when its getting called within a PS remote session: Enter-PSSession -ComputerName…
9
votes
4 answers

Can a PowerShell DSC configuration file be created from a current system build?

Is there a way to build a PowerShell desired state configuration (DSC) configuration file from a current system? Opposed of building the entire file from scratch?
Brettski
  • 952
7
votes
1 answer

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. I have powershell version 4.0. I am operating on…
6
votes
2 answers

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 be a date time of when the error was generated. …
Colyn1337
  • 2,457
  • 2
  • 25
  • 40
6
votes
2 answers

Invoke-Restmethod breaks script in PS 4.0

I had a Powershell script that used Invoke-RestMethod that was working in powershell 3.0. However, I upgraded to powershell 4.0 to fix a bug in powershell 3. When I did so, my script seems to have stopped working. $username =…
Brett G
  • 2,023
5
votes
1 answer

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 property I need, and using export-csv. I seem to…
4
votes
3 answers

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 -ComputerName serverB -ScriptBlock{gci d:\}…
4
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?
4
votes
1 answer

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 powershell I issue the command. New-WindowsImafe -capturepath…
4
votes
1 answer

Unable to install Powershell 4

I am trying to install Windows Powershell 4.0. I use Windows 7 SP1 OS (x64 Bit). I have downloaded & installed below packages already. .NET Framework 4.5. (NDP451-KB2858728-x86-x64-AllOS-ENU.exe) Windows Management Framework 4.0.…
SDG
  • 41
3
votes
2 answers

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 "DoNotExists" wasn't found. Make sure you typed the…
3
votes
1 answer

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 fairly simple workflow: WorkFlow Get-ParallelEvent { …
abstrask
  • 1,718
1
2 3 4 5