Tags "powershell-v2.0" Result

Calculating SHA1 Hash Algorithm Powershell V2.0

Does anyone know if it is possible to calculate a SHA1 Hash in Powershell V2.0? The only information I can find online is with Powershell V4.0. Solution I can't remember back in Powershell V2 days, .NET 3.5 was typically installed too. I think it's the case. You can always try the following and see if it works: $file = 'd:\scripts\sha1.ps1' $

it1352 0 2019-05-07

i want to execute a .ps1 powershell script in red hat linux server

i am having a .ps1 powershell script which executes in window, but my whole data is in linux server, is there any possible way via which i can execute the powershell script in red hat server the powershell script is : Clear-Host $path="D:\Deep Backup 26-04-2013\New folder" $systemname=Read-Host 'Enter System Name' $files=Get-ChildItem $path -R

it1352 0 2020-10-16

Memory leak using Powershell Remote Calls in C#

I have a windows service that is doing a lot of exchange remote calls to get some server information. I noticed that as longs as the time passes the memory used by the service starts growing until a memory exception is thrown. I have searched and it looks like there is a known memory leak in the System.Management.Automation that does not dispose al

it1352 90 2019-05-10

Modify attributes in AD via PowerShell (no Quest)

Say I have users and their physicalDeliveryOfficeName attribute, called Office in AD is set to New York, and others say Chicago. I want to setup a script that will loop through all users. If physicalDeliveryOfficeName = Chicago Set address properties Street: 8888 Chicago Lane City: Chicago State: IL Zip: 60066 Country: United States

it1352 2 2019-05-06

Using PowerShell to create Entity Framework DbContext

I'm trying to create powershell management scripts for my EF6 based website, but I'm struggling to create a DbContext to access my entities. Following PowerShell App.Config, I'm doing the following to load my dll, set the config file for the current app domain and instantiate my DbContext. Add-Type -AssemblyName System.Configuration [appdomain]::

it1352 2 2019-05-16

Is there a way to programmatically set the ApartmentState to STA?

I'm working on a GUI in PowerShell where I was throwing errors when certain comboboxes were clicked. After the error was thrown, I could drop the combobox list down and see it's contents, but if I shifted to another combox on the same datagridview, I would get the same initial error before I could see the drop-down list. I posted this in the Te

it1352 0 2020-07-09

Is there a way to programatically set the ApartmentState to STA?

So I'm working on a GUI in PowerShell where I was throwing errors when certain comboboxes were clicked. after the error was thrown, I could drop the combobox list down and see it's contents, but if I shifted to another combox on the same datagridview, I would get the same initial error before I could see the drop-down list. I posted this in the

it1352 1 2019-05-06

Handle command prompt error within PowerShell script

I am trying to run a few command prompt commands like schtasks within a PowerShell script. I would like to know how to handle errors thrown by the command in PowerShell. I tried: & cmd.exe /c 'schtasks /Query /TN xx || echo ERROR' & cmd.exe /c 'ping.exe 122.1.1.1 && exit 0 || exit 1' Invoke-Expression -Command:$command I'm unab

it1352 0 2020-10-03

Use cases of [ordered], the new PowerShell 3.0 feature

PowerShell 3.0 CTP1 introduces a new feature [ordered] which is somewhat a shortcut for OrderedDictionary. I cannot imagine practical use cases of it. Why is this feature really useful? Can somebody provide some useful examples? Example: this is, IMHO, rather demo case than practical: $a = [ordered]@{a=1;b=2;d=3;c=4} (I do not mind if it is sti

it1352 0 2020-10-21