return value from a scriptblock
Hi, Is it possible to get return values from a scriptblock? I am running a parallel process to process around 10000 commands through the scriptblock. The array variable $Commands contains 10000...
View ArticleHow to distinguish use of cmdlet versus alias
It appears that Microsoft did not perform a very clean vetting of verb-nouns within its own products. The Hyper-V folks have a set of cmdlets that are of the form verb-VMxxxx. It seems like the...
View ArticleI need to Health check for Web server and need report on daily basis
Hello,How to monitor Web servers ?It would be great for administrators to have a daily alert using power shell script for web serverCan anyone have any scripts that triggers email like IIS services ,...
View ArticleQuerying printers with status: Offline or Error - Offline
I m trying to query printers with status: Offline or Error - Offline.Currently I'm trying this, but it will also return printers with status: Paper jam or Toner low etc.get-WmiObject -class...
View ArticleWhen I type Wrong input , it continue to scripts
HiSorry for bad writing English.Today after i wrote a Persian wiki about backup hyper-v . i interest to learn backup hyper-v Using PowerShell .i can do it , but i create approximately automatic code...
View ArticlePSObject modify value for new object
HiI'm creating a new PSObject, as a replacement for exporting data to csv and then reimporting. Reason is i need to do some compare on LastWriteTime on the Date only, not the time. I have this part to...
View ArticleModify Active Directory users with a csv file powershell
Hey experts, i want to update our active directory users with a csv file in powershell. I want to update follow fields: company, organization, emailadress and telephone. These fields are empty or...
View ArticleCheck Vm is in Vms.
HiI want to create powershell script that ask me virtual machine and then check there is in sever or no.i use this command for input machine name$VirtualMachines = Read-Host "Please Type The...
View ArticleAD Id Expiry date output
Hello All,In our organisation, we have temp employee for whom we create a AD Id and set the user account expiry date of 45 days after creation of AD Id. We have been asked to generate the list of temp...
View Article$FormatEnumerationLimit Not Working When Powershell Script Run Through...
Hello!I have a powershell script that runs everyday based on a windows scheduled task (Win2008 R2 Server).When the scheduled task runs, my script produces a text file but it truncates some of the data...
View ArticlePowerShell to Pick New Coputer Name From Array And Reboot
I am imaging close to 200 new computers and am needing to name the computers then add them to the domain. The naming convention is pretty basic it would be AAA-123 for #1, BBB-123 for #2, CCC-123 for...
View ArticlePowerShell script to replace only primary DNS IP address on mutiple servers
Hi,i have 500+ servers in our network. They all are configured with two DNS server IP,Primary DNS IP: 10.10.10.1Secondary DNS IP: 10.10.10.2Now, we have bring up the new DNS server 10.10.10.3 and going...
View ArticleFind Web Pages which do not ask for credentials
HiI know that it is possible to send or post or insert some input into web pages using Powershellbut what i want maybe seems somehow weirdthere are about 200 Access points with Web Access enabledbut...
View ArticleForce Invoke-SQLCmd connection closed
I am writing a PS script that calls several SQL statements against an instance using Invoke-SQLCmd. One of those SQL statements restores a database; however, the previous query connections remain open...
View Article[Scopes] Execute command in specific scope
Hello fellow Powershell users,I am currently looking for a way to execute a command in a specific scope of my choice. While some commands offer a choice in how they do that, many do not. Any ideas on...
View ArticleGet_MaxWindowSize() behavior
I am looking to set the width of my console via script, based on the available real-estate. I have tried $pshost = get-host$pswindow = $pshost.ui.rawui$maxWS = ($pswindow).Get_MaxWindowSize()But this...
View ArticleEncoding with IO.File
I need to reada large file (1,5 Gb).For performance issues, I'm trying to use the [IO.File] instead of the Get-Content, but am having trouble withaccents.If I'm not mistaken,my fileis ANSI.Follows the...
View Articlecan not add value to LogonWorkstation attribute using powershell ??
I Used VB secript to add new value to LogonWorkstation"objUser.Put "logonWorkstation", strDescription "and when i checked the user attribute Editor in ADUC the LogonWorkstation attribute is set to...
View ArticleHow to replace char in 2GB Text file with Powershell?
I would like to replace all "^" char with ";" so that File get correct CSV format.File size is 2GB. Visual Studio was not able to open the file, but could not process it.I was able to replace only one...
View ArticleString Comparison based on EXE output
I got the code below$URL = "http://content3.catalog.video.msn.com/e2/ds/3416835b-d0fc-412a-8de5-d2101ff48341.mp4" $wget = "C:\Program Files (x86)\GnuWin32\bin\wget.exe" $URLfilesize = &$wget -S...
View Article