Call function from target script at remote script
Hello,My script looks like this:cls $RemoteServer = "zserver101" $WorkItemID = "202" $WorkItemState = "Stage to CONS" Function LoglinesSmall { Write-Host "" Write-Host " -------------------" Write-Host...
View ArticleDbNull Treatment in PoSh 2 vs. 3
PoSh v3 apparently interprets System.DbNull values differently than PoSh v2.In v2, this expression returns True: [System.DbNull]::Value -eq $null. In v3, it returns False.More specifically, in v3...
View ArticleRead servernames from text file and perform action for all of them
Hi allI have the following code$CheckOut =Get-EventLog-ComputerNameNameofServer-LogNameSystem|where{$_.eventID-eq1074} |ft-AutoSize-Wrap|Out-String$today = Get-Date -format dSend-MailMessage...
View ArticleConvet to HTML
How can I convert my script to HTML? I've tried with convertto-html but it comes out unformatted.import-module failoverclusters $clustername = 'myclustername' $resources = get-cluster $clustername |...
View ArticleExchange move users in OU
HelloIs it possible to prompt a admin who is running a PS script for information. I am using the script below to get the users from an OU and move them from exchange 2003 DB to a new DB on exchange...
View ArticleProblems with directory traversal
Hello,I've recently started learning PowerShell and I've been running into some problems with this piece of code: pastebin.com/NRDjXKvW .This is a part of the output i'm getting: D:\workspace\ASC...
View ArticlePowershell Simple addition of array element integers
HiI'm able to do this simple task in VBS but can't figure out the syntax in PS. Basically I need to gather the total disk space used for a number of files in different folders. Thant I can happily do...
View Articlepowershell script to modify web.config file
HI All,I have Powershell script to modify web.config file's connection String with XML modifier, but its not working as expected.Task is powershell query should take the data from XML and update the...
View ArticleOutput list view shows dotted lines
HiI'm writing a small script to get information about my servers. One of the things I'm doing is getting FSMO roles like this: $AllDomainControllers = Get-ADDomainController -Filter * -server...
View ArticleHow can I run diskshadow (List Shadows all) for multiple servers?
Hi all, At the moment I have to logon to 20+ servers and check for any snapshots and clear them down. I want to automate the listing of the snapshots but it I cant seem to remotely rundiskshadow. I...
View ArticleMy first PowerShell script, also my first C# code -- extracting a zipped file
I'm familiar with coding in VBA but this is my first PowerShell script and my first C# code.I've been tasked with writing a PowerShell script to unzip a file and then change the filename. Unzipping the...
View ArticleExchange Message Count
Hi There,I am using the cmdlet below to extract the number of messages received by a users in Exchange 2010. it works fine and give me the message count however I cannot find a way to output the...
View ArticleCheck Whether drive exists
function get-checkdrive($server) { write-verbose "check drive -started" $check= 'D:\' # no escape $testobj=get-wmiobject win32_volume -filter "DriveLetter= 'D:'" -computername $server $caption=...
View ArticleNew-PSSession limited to 25
I am trying to start 50 sessions on a server, but once I pass 25 new sessions, I get this error: New-PSSession : [MyServer] Connecting to remote server systemarchi failed with the following error...
View Articleadd file name without extension to combined output
I have a script that combines all (.dat) files from a folder into a specific output file. I would like to write at the end of each line the file name from where it originated. I do some backups to...
View ArticleAsynchronous Timer Events not working when script run via batch file
Hello.I have a PowerShell script that uses an Asynchronous Timer Event (background process) to measure how long a certain condition has been occurring before taking appropriate action.This is working...
View ArticleDo-While loop until input is null
Hello, I am trying to write a script to do something with user names that is entered in at the input.$users = @() Do {$users += Read-Host "What is the username: "} until ($users -eq "")I have that code...
View ArticlePowershell Get-WmiObject -Class Win32_LogicalDisk -ComputerName $k - not...
helloThis is my first post, please be understanding.This is my script$hosty = net view foreach ($j in $hosty) { if ($j -match 'ROW') { $k = $j -replace '\\*' ForEach ( $i in (Get-WmiObject -Class...
View ArticleComparison of dhcp scope with AD sites & service through power shell
Hi All,I am thinking of something that could parse through all Scopes in all DHCP servers and then make sure that there is a site and a subnet associated with that DHCP Scope. How can we get this done...
View ArticleError Handling during Import from CSV (Using Set-QADUser)
Folks,I'm using the Quest Set-QADUser powershell along with the Import-CSV command (see below for syntax) and I am having some issues with error handling that I need advice on. Essentially the import...
View Article