Create VNet in resource group using PowerShell

I need to create a VNet within a Resource Group.  The old portal lets me create a VNet but places it in a "Default-Networking" resource group which is not what we want (we have a naming convention to follow for programming etc).  The
new portal lets me create a Resource Group but not a VNet.  I am not a dev, I am a sysadmin so I do not use Visual Studio (which Resource Manager seems to be made for). I have tried using PowerShell (in ARM mode) by first making a Resource Group, and
then running a PowerShell command in an attempts to create a VNet and add it to the Resource Group:
New-AzureResource -ApiVersion 2014-06-01 -Location "Australia Southeast" -Name devausevnet -ResourceGroupName devausevnet -ResourceType Microsoft.ClassicNetwork/virtualNetworks
I got an error: "New-AzureResource : InvalidAuthorizationAppId: The appId <blah> is not allowed to make requests via API for 'PUT' operations..."
I tried doing this by making the resource group at the same time as calling the creation of a vnet via a template as well, but after prompting me for the values for the vnet, that got the exact same error.
I have found a page that suggests ARM is not yet able to create a VNet via PowerShell.
https://social.msdn.microsoft.com/Forums/office/en-US/f40b24dc-8c82-411e-871a-be3710743ec1/unable-to-create-azure-virtual-machine-using-resource-group-template?forum=WAVirtualMachinesforWindows
OK, so how am I supposed to create a VNet in a Resource Group that has a name other than "Default-Networking" please?
While I love the direction Azure is heading, I am becoming very frustrated with the number of things like this that seem to be partially functional in the old portal, the new portal, PowerShell etc.  If
there is no cohesive means of doing this as yet, is someone able to provide a work-around?  Note that it is not yet even possible to rename a Resource Group otherwise I would have simply done that.
Any help appreciated!  Cheers.   =) 

Hi,
Based on my experience, there is no resource type for virtual networks in Azure PowerShell. In addition, to define a virtual network, you need to configure the address space as the property. The article below may be helpful to you:
Azure Resource Manager– Creating a Resource Group and a VNET
Furthermore, you can create a virtual network in a new resource group or a new one in
Azure Preview portal:
Best regards,
Susie
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

Similar Messages

  • Error while creating resource group using non-globalzones.

    Dear all,
    Hi techs please guide me how to create failover resource group in nongloablzones.
    I'm getting error while creating resource group using non-globalzones.
    My setup:
    I have two node cluster running sun cluster 3.2 configured and running properly.
    node1: sun5
    nide2: sun8
    I have create non-globalzone "zone1" in node:sun5
    I have create non-globalzone "zone2" in node:sun8
    node:sun5# clrg create -n sun5:zone1,sun8:zone2 zonerg
    *(C160082) WARNING: one or more zones in the node list have never been fully booted in the cluster mode,verify that correct zone name was entered.*
    kindly guide me how to create Apache resource group using non-glabalzones, i'm new to sun cluster 3.2. please guide me step by step information.
    Thanks in advance,
    veera
    Edited by: veeraa on Dec 19, 2008 1:54 AM

    Hi Veera,
    Actually you are getting a warning message where one of two things could have happened. Either you specified an incorrect zone name or one of the zones has not been fully booted. It's likely that you haven't booted the zones, so please follow this:
    zoneadm list -iv
    If zone1 or zone2 are not running then boot and configure them
    zoneadm -z <zone> boot
    zlogin -C <zone>
    After that you can continue to follow the step by step instructions at
    http://docs.sun.com/app/docs/doc/819-2975/chddadaa?a=view
    These may also help
    http://blogs.sun.com/Jacky/entry/a_simple_expample_about_how
    http://blogs.sun.com/SC/en_US/entry/sun_cluster_and_solaris_zones
    Regards
    Neil

  • How do you create a new resource group from the new portal?

    There's no option for new resource group when you click the "+" button. Am I missing something?

    Hi mticb,
    As far as I know, we couldn't create an empty resource group in azure preview portal, please vote this similar feedback at:
    http://feedback.azure.com/forums/223579-azure-preview-portal/suggestions/6182477-create-resource-groups, sorry for any inconvenience.
    Best Regards,
    Jambor
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Unable to remove user from SharePoint Group using PowerShell

    I am trying to remove a user from a SharePoint Group using PowerShell.
    I can see the user in the Site Collection as part of the SharePoint Group, however, when I attempt to run the script, I get an error message stating "Can not find the user with ID: 10"
    Below is the PowerShell script that I am using:
    $url = "https://sharepointdev.spfarm.spcorp.com/sites/desitecoll"
    $userName = "spfarm\sp2013_svc"
    #$userName = "spfarm\spprofileimport";
    $site = New-Object Microsoft.SharePoint.SPSite($url)
    $web = $site.OpenWeb()
    $siteGroups = $web.SiteGroups;
    Clear-Host
    $mySiteGroups = @();
    foreach($group in $siteGroups)
    Write-Host $group
    $mySiteGroups += $group;
    }#foreach
    $members = $web.SiteGroups[$mySiteGroups[0]];
    $owners = $web.SiteGroups[$mySiteGroups[1]];
    $visitors = $web.SiteGroups[$mySiteGroups[2]];
    #Remove the user from the specified SharePoint Group
    $spUser = Get-SPUser -Identity $userName -Web $url
    Write-Host $spUser.ID
    Remove-SPUser -Identity $spUser -Web $url -Group $owners
    $web.Update();
    $web.Dispose();
    Write-Host "User " $userName "removed from " $owners
    Please advise.

    I had to update the code to the following because Get-SPUser was not working properly:
    $url = "https://sharepointdev.spfarm.spcorp.com/sites/desitecoll"
    $userName = "spfarm\spprofileimport";
    $site = New-Object Microsoft.SharePoint.SPSite($url)
    $web = $site.OpenWeb()
    $siteGroups = $web.Groups;
    Clear-Host
    $mySiteGroups = @();
    foreach($group in $siteGroups)
    Write-Host $group
    $mySiteGroups += $group;
    }#foreach
    $members = $web.Groups[$mySiteGroups[0]];
    $owners = $web.Groups[$mySiteGroups[1]];
    $visitors = $web.Groups[$mySiteGroups[2]];
    #Convert the user name to an SPUser account
    $spUser = $web.Site.RootWeb.EnsureUser($userName);
    Write-Host $spUser.ID
    Remove-SPUser -Identity $spUser -Web $url -Group $owners
    $web.Update();
    $web.Dispose();
    Write-Host "User " $userName "removed from " $owners
    Was I not using Get-SPUser correctly?

  • How to Create Windows Firewall Predefined rules using Powershell

    Windows Firewall Predefined rules using Powershell
    Following commands are working some time however sometimes it's giving errors. Any help would be appreciated
    WORKING ==> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True 
    Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Inbound
    NOT WORKING
    PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
    Set-NetFirewallRule : One of the port keywords is invalid.
    At line:1 char:1
    + Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se 
       t-NetFirewallRule], CimException
        + FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule
    PS C:\Windows\system32> Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Direction Outbound
    Set-NetFirewallRule : One of the port keywords is invalid.
    At line:1 char:1
    + Set-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Enabled True -Dire ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidArgument: (MSFT_NetFirewal...ystemName = ""):root/standardcimv2/MSFT_NetFirewallRule) [Se 
       t-NetFirewallRule], CimException
        + FullyQualifiedErrorId : HRESULT 0x80070057,Set-NetFirewallRule
    Anoop C Nair (My Blog www.AnoopCNair.com)
    - Twitter @anoopmannur -
    FaceBook Forum For SCCM

    The command:
    Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound
    produces the output:
    Name : FPS-NB_Session-In-TCP
    DisplayName : File and Printer Sharing (NB-Session-In)
    Description : Inbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Session-Out-TCP
    DisplayName : File and Printer Sharing (NB-Session-Out)
    Description : Outbound rule for File and Printer Sharing to allow NetBIOS Session Service connections. [TCP 139]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-SMB-In-TCP
    DisplayName : File and Printer Sharing (SMB-In)
    Description : Inbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-SMB-Out-TCP
    DisplayName : File and Printer Sharing (SMB-Out)
    Description : Outbound rule for File and Printer Sharing to allow Server Message Block transmission and reception via Named Pipes. [TCP 445]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Name-In-UDP
    DisplayName : File and Printer Sharing (NB-Name-In)
    Description : Inbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Name-Out-UDP
    DisplayName : File and Printer Sharing (NB-Name-Out)
    Description : Outbound rule for File and Printer Sharing to allow NetBIOS Name Resolution. [UDP 137]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Datagram-In-UDP
    DisplayName : File and Printer Sharing (NB-Datagram-In)
    Description : Inbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-NB_Datagram-Out-UDP
    DisplayName : File and Printer Sharing (NB-Datagram-Out)
    Description : Outbound rule for File and Printer Sharing to allow NetBIOS Datagram transmission and reception. [UDP 138]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP4-ERQ-In
    DisplayName : File and Printer Sharing (Echo Request - ICMPv4-In)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP4-ERQ-Out
    DisplayName : File and Printer Sharing (Echo Request - ICMPv4-Out)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP6-ERQ-In
    DisplayName : File and Printer Sharing (Echo Request - ICMPv6-In)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-ICMP6-ERQ-Out
    DisplayName : File and Printer Sharing (Echo Request - ICMPv6-Out)
    Description : Echo Request messages are sent as ping requests to other nodes.
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-LLMNR-In-UDP
    DisplayName : File and Printer Sharing (LLMNR-UDP-In)
    Description : Inbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    Name : FPS-LLMNR-Out-UDP
    DisplayName : File and Printer Sharing (LLMNR-UDP-Out)
    Description : Outbound rule for File and Printer Sharing to allow Link Local Multicast Name Resolution. [UDP 5355]
    DisplayGroup : File and Printer Sharing
    Group : @FirewallAPI.dll,-28502
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Outbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    The command:
    (Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Outbound).DisplayName
    shows the display names of the 14 outbound rules in the FPS group:
    File and Printer Sharing (NB-Session-In)
    File and Printer Sharing (NB-Session-Out)
    File and Printer Sharing (SMB-In)
    File and Printer Sharing (SMB-Out)
    File and Printer Sharing (NB-Name-In)
    File and Printer Sharing (NB-Name-Out)
    File and Printer Sharing (NB-Datagram-In)
    File and Printer Sharing (NB-Datagram-Out)
    File and Printer Sharing (Echo Request - ICMPv4-In)
    File and Printer Sharing (Echo Request - ICMPv4-Out)
    File and Printer Sharing (Echo Request - ICMPv6-In)
    File and Printer Sharing (Echo Request - ICMPv6-Out)
    File and Printer Sharing (LLMNR-UDP-In)
    File and Printer Sharing (LLMNR-UDP-Out)
    If your output is different than this, it means rules have been removed (or added) to the File and Print Sharing group.
    For example, if you run the command:
    New-NetFirewallRule -DisplayName "My test rule 2" -group "File and Printer Sharing" -Enabled True -Protocol tcp -LocalPort 12346 -Direction Inbound
    This adds a new inbound firewall rule to the FPS group. Output looks like:
    Name : {06449724-944b-4048-834f-8870b9dce4f6}
    DisplayName : My test rule 2
    Description :
    DisplayGroup : File and Printer Sharing
    Group : File and Printer Sharing
    Enabled : True
    Profile : Any
    Platform : {}
    Direction : Inbound
    Action : Allow
    EdgeTraversalPolicy : Block
    LooseSourceMapping : False
    LocalOnlyMapping : False
    Owner :
    PrimaryStatus : OK
    Status : The rule was parsed successfully from the store. (65536)
    EnforcementStatus : NotApplicable
    PolicyStoreSource : PersistentStore
    PolicyStoreSourceType : Local
    This test rule is of course useless because there's no listener on TCP port 12346 on this particular machine..
    The new rule can also be viewed in Windows Firewall with Advanced Security:
    Now if you run the command:
    (Get-NetFirewallRule -DisplayGroup "File and Printer Sharing" -Direction Inbound).DisplayName
    the output will look like:
    File and Printer Sharing (Spooler Service - RPC)
    File and Printer Sharing (Spooler Service - RPC-EPMAP)
    My test rule 2
    Sam Boutros, Senior Consultant, Software Logic, KOP, PA http://superwidgets.wordpress.com (Please take a moment to Vote as Helpful and/or Mark as Answer, where applicable)

  • How to create a profit center group using MDG-F?

    Given that there is a controlling area CA created in ECC. under which there is a standard profit center hierarchy let us call it ABCD created. Under ABCD, there is a Profit Center Group PCG01 already created in ECC. Now what steps (or screens) I should go through on MDG-F if I want to create another profit center group PCG02 that should be placed under PCG01? Thanks for your help.

    Hi ,
    First of all you need to create Profit Center from Create Change Request by selecting the change request type of PCTR Single Processing.
    Complete the all approval of the Profit center. Once your PCTR gets activated , it will go & sits into MDG tables ONLY.
    You have to make a replication setup of Local replication for replicating this created PCTR via MDG to the ECC Back end so that you can see the same data in the CEPC table.
    Once you are done with this, use Collective Processing form Change Request of PFCG role where you can create your PCTRG & PCTRH . You can assign the PCTR to PCTRG & PCTRH accordingly.
    Hope this answers your all questions.
    Best Regards,
    Kaustubh

  • Creating a diskpart script file using Powershell

    Hi,
    I have a very odd (and very annoying) problem...
    I have a powershell script which creates a diskpart file to online any given number of iSCSI attached disks.  The powershell script takes input from a csv which includes the disk numbers then creates a txt file with the relevent diskpart commands (e.g
    select disk X, online disk, etc..)
    The powershell script runs without error and creates the output file, however when I attempt to run diskpart with the outputfile (i.e. diskpart /s outputfile.txt) diskpart does not acknowledge/accept the file and just returns a list of valid commands. 
    Yet if I manually create a empty txt file via Windows Explorer and copy and paste the contents of the powershell generated script file in to it, then run the diskpart against this file all works as expected.
    So it seems as though that in writing to the file via powershell something is happening to the file fortmatting which diskpart does not like - any ideas what?
    I have tried several work arounds including manually creating the txt file before running the powershell and creating the txt file explicitly from powershell but get the same result.
    Although I can workaround the issue as described above it would be nice to get this working as intended, or least understand why the problem occurs - so any help/advice would (as always) be much appreciated!
    for reference the powershell script is detailed below:
    $a="select disk "
    $b="attributes disk clear readonly"
    $c="online disk"
    import-csv .\input.csv | foreach {
     $a+$_.diskNumber >> outputfile.txt
     $b >> outputfile.txt
     $c >> outputfile.txt

    Kazun,
    Thank you for sharing your script. I tired it but did not work for me. I modified yours slightly to configure 134 SAN devices as mount points.   I've already set the SAN policy to OnlineAll and cofigured 4 other devices. When I run the diskpart
    commands per disk from CLI its works. Please let me know what I'm missing.Thank you.
    $B = import-csv -Path "C:\Support\Prep_Disks\3-CreateMountPoints\MountPoints.csv"
    $B | Foreach-Object {
    $DiskNum = $_.DiskNumber
    $MP = $_.MountPath
    $DiskLBL = $_.DiskLabel
    $command = @"
    SELECT DISK $DiskNum
    ATTRIBUTES DISK CLEAR READONLY
    ONLINE DISK
    CONVERT MBR
    CREATE PARTITION PRIMARY
    ASSIGN MOUNT=$MP
    FORMAT FS=NTFS UNIT=64k LABEL=$DiskLBL QUICK
    $command | diskpart

  • Create AD group using powershell

    foreach ($item in $list) {
     If ($item.GroupName -eq "") {
            Write-Host "[ERROR]`t Please provide valid group details in spreadsheet."  -ForegroundColor Red
          } Else {
          $item.ID = $ou
        New-ADGroup -Name $item.GroupName –path “OU=$ou,DC=account,DC=company,DC=com”  -GroupCategory Security -GroupScope DomainLocal
    I am getting a syntax error because of OU=$ou. Any idea how to fix this?

    Try {
      Import-Module ActiveDirectory -ErrorAction Stop
    Catch {
      Write-Host "[ERROR]`t ActiveDirectory Module couldn't be loaded. Script will stop!" -ForegroundColor Red
      Exit 1
    $path     = Split-Path -parent $MyInvocation.MyCommand.Definition
    $newpath  = $path + "\creategroups.csv"
    $list = Import-Csv $newpath
    Function Start-Commands {
      Create-Groups
    Function Create-Groups {
    foreach ($item in $list) {
     If ($item.GroupName -eq "") {
            Write-Host "[ERROR]`t Please provide valid group details."  -ForegroundColor Red
          } Else {
          $item.ID = $ou
        New-ADGroup -Name $item.GroupName –path “OU=$ou,DC=company,DC=com”  -GroupCategory Security -GroupScope DomainLocal
        Write-Host "[INFO]`t Created new group : $($item.GroupName)" -ForegroundColor Green
    Write-Host "STARTED SCRIPT`r`n"  -ForegroundColor Cyan
    Start-Commands
    Write-Host "STOPPED SCRIPT" -ForegroundColor Cyan
    New-ADGroup : The server is unwilling to process the request
    At C:\Users\t-user-aws\Desktop\test\CreateGroups.ps1:29 char:5
    +     New-ADGroup -Name $item.GroupName –path 'OU=$item.ID,DC=DC=company, ...
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (CN=TestGroupB,O...as,DC=com:String) [New-ADGroup], ADException
        + FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.NewADGroup

  • Can't create disk image: "Resource in use"

    I'm trying to make a disk image of my internal hard drive on my external hard drive using Disk Utility, prior to installing a new internal hard drive, so I can migrate the original hard drive's contents to the new internal hard drive. But when I go to Disk Utility, and try to make a disk image of the internal hard drive (File>New>Disk Image from Drive[name]), it briefly starts to make the copy but then quickly goes to a screen that says "Unable to create "disk0.dmg. Resource busy"
    ANY CLUES AT TO WHAT THIS MEANS?
    IS THERE ANY BETTER WAY TO MAKE A FULL COPY OF MY CURRENT INTERNAL HARD DRIVE FOR THE PURPOSE OF COPYING BACK ONCE I HAVE A NEW HARD DRIVE INSTALLED?
    Thanks!

    It's not actually a bug, it's just not possible. Windows won't even let you backup the system drive while you are booted in it. You need third party software, such as SuperDuper, CCC (Carbon Copy Clone), or Norton Ghost (Windoz only).
    It must be done while not booted onto the primary system. Using the Disk Utility while booted from the installatin disk is possible, but not recommended. Best to use DU from OS X of the same minor version to create the disk image. Example, if your system is OS X 10.4.9 use DU from 10.4.9 to create the disk. This is only possible if you have another computer connected to yours.
    An alternative, is to have a bare bones copy of OS X 10.4.9 (or whatever your version is) on an external drive. Make sure it's updated with the latest updates and the permissions are verifided. Then copy your primary volume while booted from the external drive.
    Check out Michael Snow's comments:
    http://macosg.com/group/viewtopic.php?t=12990&postdays=0&postorder=asc&start=0
    Also:
    "Good reading about the effectiveness of various backup tools on OS X.
    http://blog.plasticsfuture.org/2006/03/05/the-state-of-backup-and-cloning-tools- under-mac-os-x/ "
    MacBook Pro 17"   Mac OS X (10.4.8)   2.16GHz CoreDuo, 2GB RAM

  • No Resource Group created

    Hi,
    all I have an Azure Test account and I wanted to set up a SharePoint Testfarm.
    Nearly everything works fine, but the field, where I have to type in a resource Group NEVER turns green. No matter what I put there.
    Any Ideas? Did I miss something upfront?
    Thanks for your help!
    Cheers Matthias

    Hi,
     Thanks for Posting.
     Since the portal is still in preview, we might not be able to provide an immediate solution to the issue.
     However you can try the following steps and let us know if it works.
     Try using a different browser and check
     Clear cookies and temporary files in Browser and check again.
     Have you tried creating a new Resource Group after some time, and did it work.
     You can try creating a Sharepoint farm using Powershell using the following links
    http://azure.microsoft.com/blog/2013/05/24/automating-sharepoint-deployments-in-windows-azure-using-powershell/
    http://www.c-sharpcorner.com/UploadFile/ManasMoharana/configuring-sharepoint-2013-farm-on-windows-azure-vm-using-p/
    If you want to give feedback to Development team regarding the Preview Portal, you can do so at the following site.
     http://feedback.azure.com/forums/223579-azure-preview-portal
    Regards,
    Nithin.Rathnakar

  • Creating user in AD using powershell

    Hi,
    How to create ad user in opalis using powershell?

    Hi,
    best will be, you take the "Run .Net Activity" and put your PowerShell Script in there.
    Example Script
    new-aduser $LoginName -GivenName $FirstNameField -Surname $LastnameField -DisplayName $Displayname -UserPrincipalName "$[email protected]" -ChangePasswordAtLogon $true -AccountPassword (ConvertTo-SecureString –AsPlainText “password1password_1” -Force) -Path "OU=$OU,OU=User,OU=Company,DC=domain,DC=com" -Company $Company -Department $Department -enabled $true -EmployeeNumber $EmployeeNumber -Description $EmployeeNumber -EmailAddress $SMTPAdresse -Division $Division
    Seidl Michael | http://www.techguy.at |
    twitter.com/techguyat | facebook.com/techguyat

  • Need to create Meeting Request using Powershell with Outlook 2010 / 2013

    We will be creating around 100 meeting request based on data from excel, so planning to migrate it to SQL & using powershell we need to speed-up the progress.
    Script tried :
    http://social.technet.microsoft.com/Forums/scriptcenter/en-US/e88ca51c-62dd-493b-a0d1-ffe6a8696fdf/create-view-in-outlook-2013-using-powershell?forum=ITCG
    http://en.community.dell.com/techcenter/powergui/f/4833/t/19576698.aspx
    http://www.amandhally.net/2013/08/30/powershell-and-outlook-create-and-send-a-new-email-using-powershell-outlooktools-module/
    Do we have any working scripts, i tried few scripts it fails throwing error as below:
    New-Object : Exception calling ".ctor" with "0" argument(s): "Retrieving the COM class factory for component with CLSID 
    {0006F03A-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 
    0x80080005 (CO_E_SERVER_EXEC_FAILURE))."
    At line:2 char:6
    + $o = New-Object Microsoft.Office.Interop.Outlook.ApplicationClass
    +      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
        + FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
    You cannot call a method on a null-valued expression.
    At line:4 char:1
    + $a = $o.CreateItem($olAppointmentItem)
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
        + FullyQualifiedErrorId : InvokeMethodOnNull
    Ganapathy

    Hi Ganapathys,
    For the error "failed due to the following error: 80080005", please Make sure that Outlook and Powershell are either both running as a standard user (not elevated) or that they are both running elevated as Administrator. They need to be running at the same
    integrity level to avoid that error.
    Please try to run powershell as standard user without "run as admin".
    If you have any feedback on our support, please click here.
    Best Regards,
    Anna Wang
    TechNet Community Support

  • Creating Windows Basic Task using powershell

    Hello Everyone,
    Please help me out in the below situation:
    I have to create a basic windows task using powershell to run a script on a specific date and time.
    Let me make it even clear :
    I have a csv say,
    D:\xyz.csv
    ServerName ,  Date  , Time
    Random1,   11/15/2014,01:00:00PM
    Random2,   12/01/2015,03:00:00PM
    ...and so on
    I also have a script at E:\TestingServer.ps1
    I need to create list of windows tasks to invoke TestingServer.ps1 with parameters as servername and Time of task as given date and time in csv.
    Task1- with input as ServerName at Date and time from CSV
    Task2-with input as ServerName at Date and time from CSV

    Well here is a good article showing howto do this:
    http://blogs.technet.com/b/heyscriptingguy/archive/2012/09/18/create-a-powershell-scheduled-job.aspx
    ¯\_(ツ)_/¯

  • Using Powershell to execute DBCC CheckDB from SQL Agent.

    So, I have a weird situation that I think is tied tot he resource group and powershell, but I am having trouble determining if it is that or not. I run DBCC CheckDB using a resource pool and a secondary account. The account has permissions to do the work
    and if I log onto the server and run the procedure locally it runs fine in the resource pool configuration. However, when I kick it from the SQL Agent job using the powershell step, it only does checkDB on the first 3 system databases and then stops once it
    hits a user database. I am not seeing any errors or messages, it just stops. I ran profiler and I see it do the work, get to the first user database, issues this statement from DBCC, then just stops, and the job ends.
    SELECT @BlobEater = CheckIndex (ROWSET_COLUMN_FACT_BLOB)
    FROM { IRowset 0xD0936A7902000000 }
    GROUP BY ROWSET_COLUMN_FACT_KEY
    >> WITH ORDER BY
      ROWSET_COLUMN_FACT_KEY,
      ROWSET_COLUMN_SLOT_ID,
      ROWSET_COLUMN_COMBINED_ID,
      ROWSET_COLUMN_FACT_BLOB
    OPTION (ORDER GROUP)
     I am not doing anything special in my code that would limit which databases to process. As I said earlier, executing the call to the procedure from a query window runs as expected and processes all of the databases.
    Here is the Agent Code calling powershell:
    [string] $DayOfWeek = ""
    $DayOfWeek = (get-date).DayOfWeek.ToString()
    $DayOfWeek
    if ($DayOfWeek -eq 'Sunday')
    invoke-sqlcmd -database sysadm -serverinstance HQIOSQLDEV01\DEV01 "exec ConsistencyCheck.upConsistencyCheck NULL, 'N', 'Y', 'N', 'N', 'N'"
    else
    invoke-sqlcmd -database sysadm -serverinstance HQIOSQLDEV01\DEV01 "exec ConsistencyCheck.upConsistencyCheck NULL, 'Y', 'N', 'N', 'N', 'N'"
    John M. Couch

    There are 3 additional databases. The last known good is today as I am able to execute the procedure via query window just fine. It is only when executed from a SQL Agent job as above that it stops after only doing the System Databases. The largest database
    is 130GB in size, with the largest table being 62 GB.
    -- Create Procedures
    raiserror('Creating Procedure ''%s''', 0, 1, '[ConsistencyCheck].[upConsistencyCheck]')
    go
    /*==============================================================================
    Procedure: upConsistencyCheck
    Schema: ConsistencyCheck
    Database: SysAdm
    Owner: dbo
    Application: dbo
    Inputs: Catalogue : nvarchar(128) : NULL = All Databases
    Physical Only : nchar(1) : Y/N, NULL = N
    Data Purity : nchar(1) : Y/N, NULL = N
    No Index : nchar(1) : Y/N, NULL = N
    Extended Logical Checks : nchar(1) : Y/N, NULL = N
    Table Lock : nchar(1) : Y/N, NULL = N
    Outputs: (0 = Success, !=0 = failure)
    Result Set: N/A
    Usage: declare @ii_Rc int
    ,@invc_Catalogue nvarchar(128)
    ,@inc_PhysicalOnly nchar(1)
    ,@inc_DataPurity nchar(1)
    ,@inc_NoIndex nchar(1)
    ,@inc_ExtendedLogicalChecks nchar(1)
    ,@inc_TabLock nchar(1)
    select @invc_Catalogue = NULL
    ,@inc_PhysicalOnly = 'Y'
    ,@inc_DataPurity = 'N'
    ,@inc_NoIndex = 'N'
    ,@inc_ExtendedLogicalChecks = 'N'
    ,@inc_TabLock = 'N'
    exec @ii_Rc = ConsistencyCheck.upConsistencyCheck @invc_Catalogue
    , @inc_PhysicalOnly
    , @inc_DataPurity
    , @inc_NoIndex
    , @inc_ExtendedLogicalChecks
    , @inc_TabLock
    print 'Return Code: ' + convert(varchar, @ii_Rc)
    Description: This Procedure is used to run DBCC CheckDB on 1 or all Databases
    on the existing instance.
    Version: 1.00.00
    Compatability: SQL Server 2008 (100)
    Created By: John M. Couch
    Created On: 04-26-2012
    ================================================================================
    Notes
    1. Some logic was taken directly from Ola Hallengren's Maintenance Script.
    http://ola.hallengren.com
    ================================================================================
    History: (Format)
    When Who Version Code Tag What
    04-26-2012 John Couch 1.00.00 (None) Initial Revision
    ==============================================================================*/
    alter procedure ConsistencyCheck.upConsistencyCheck (@invc_Catalogue nvarchar(128)
    ,@inc_PhysicalOnly nchar(1)
    ,@inc_DataPurity nchar(1)
    ,@inc_NoIndex nchar(1)
    ,@inc_ExtendedLogicalChecks nchar(1)
    ,@inc_TabLock nchar(1)) as
    /*==============================================================================
    Variable Declarations & Temporary Tables
    ==============================================================================*/
    declare @li_Rc int = 0
    ,@lnvc_ExecutedBy nvarchar(128) = user_name()
    ,@ldt_ExecutedOn datetime = getdate()
    ,@lnvc_Catalogue nvarchar(128) = @invc_Catalogue
    ,@lnc_PhysicalOnly nchar(1) = coalesce(@inc_PhysicalOnly, 'N')
    ,@lnc_DataPurity nchar(1) = coalesce(@inc_DataPurity, 'N')
    ,@lnc_NoIndex nchar(1) = coalesce(@inc_NoIndex, 'N')
    ,@lnc_ExtendedLogicalChecks nchar(1) = coalesce(@inc_ExtendedLogicalChecks, 'N')
    ,@lnc_TabLock nchar(1) = coalesce(@inc_TabLock, 'N')
    ,@lnvc_Instance nvarchar(128) = cast(serverproperty('ServerName') as nvarchar)
    ,@lnvc_Version nvarchar(40) = cast(serverproperty('ProductVersion') as nvarchar)
    ,@lnvc_Edition nvarchar(40) = cast(serverproperty('Edition') as nvarchar)
    ,@li_Compatibility int
    ,@ldt_CreateDate datetime
    ,@lnvc_UserAccess nvarchar(35)
    ,@lnvc_StateDescription nvarchar(35)
    ,@lnvc_PageVerifyOption nvarchar(35)
    ,@lti_IsReadOnly tinyint
    ,@lti_IsInStandBy tinyint
    ,@lnvc_Recipients nvarchar(2000) = '[email protected]'
    ,@lnvc_Subject nvarchar(128)
    ,@lnvc_ErrorMessage nvarchar(4000)
    ,@lnvc_SQL nvarchar(max)
    ,@lnvc_ManualSQL nvarchar(max)
    ,@lnvc_Query nvarchar(2048)
    ,@li_ConsistencyCheckID int
    ,@ldt_ExecutionStart datetime
    ,@ldt_ExecutionFinish datetime
    declare @ltbl_Catalogue table (Catalogue sysname
    ,CompatibilityLevel int
    ,CreateDate datetime
    ,UserAccess nvarchar(35) -- MULTI_USER, SINGLE_USER, RESTRICTED_USER
    ,StateDescription nvarchar(35) -- ONLINE, RESTORING, RECOVERING, RECOVERY_PENDING, SUSPECT, EMERGENCY, OFFLINE
    ,PageVerifyOption nvarchar(35) -- NONE, TORN_PAGE_DETECTION, CHECKSUM
    ,IsReadOnly tinyint
    ,IsInStandBy tinyint
    ,IsAutoShrink tinyint
    ,IsAutoClose tinyint
    ,Flag bit default 0)
    create table #ltbl_Output (Error int,
    Level int,
    State int,
    MessageText nvarchar(max),
    RepairLevel nvarchar(30),
    Status int,
    DBID smallint,
    ObjectID int,
    IndexID smallint,
    PartitionID bigint,
    AllocunitID bigint,
    [File] int,
    Page int,
    Slot int,
    RefFile int,
    RefPage int,
    RefSlot int,
    Allocation int)
    /*==============================================================================
    Initialize Environment
    ==============================================================================*/
    set nocount on
    set quoted_identifier on
    /*==============================================================================
    Parameter Validation
    ==============================================================================*/
    -- Configure Alert Mail Subject Line
    set @lnvc_Subject = 'Check consistency parameter validation error occurred on ' + cast(@@servername as nvarchar)
    if @lnc_PhysicalOnly not in ('Y','N')
    begin
    set @lnvc_ErrorMessage = N'The value for parameter @inc_PhysicalOnly is not supported.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @lnc_DataPurity not in ('Y','N') and @li_Rc = 0
    begin
    set @lnvc_ErrorMessage = N'The value for parameter @inc_DataPurity is not supported.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @lnc_NoIndex not in ('Y','N') and @li_Rc = 0
    begin
    set @lnvc_ErrorMessage = N'The value for parameter @inc_NoIndex is not supported.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @lnc_ExtendedLogicalChecks not in ('Y','N') and @li_Rc = 0
    begin
    set @lnvc_ErrorMessage = N'The value for parameter @inc_ExtendedLogicalChecks is not supported.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @lnc_TabLock not in ('Y','N') and @li_Rc = 0
    begin
    set @lnvc_ErrorMessage = N'The value for parameter @inc_TabLock is not supported.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @lnc_ExtendedLogicalChecks = 'Y' and @lnc_PhysicalOnly = 'Y' and @li_Rc = 0
    begin
    set @lnvc_ErrorMessage = N'Extended Logical Checks and Physical Only cannot be used together.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @lnc_DataPurity = 'Y' and @lnc_PhysicalOnly = 'Y' and @li_Rc = 0
    begin
    set @lnvc_ErrorMessage = N'Physical Only and Data Purity cannot be used together.' + char(13) + char(10) + ' '
    set @li_Rc = -1
    end
    if @li_Rc != 0
    goto errlog
    /*==============================================================================
    Code Section
    ==============================================================================*/
    select @lnvc_SQL = N'select d.name, d.compatibility_level, d.create_date, d.user_access_desc, d.state_desc,
    d.page_verify_option_desc, cast(d.is_in_standby as tinyint), cast(d.is_read_only as tinyint),
    cast(databasepropertyex(quotename(d.name), ''IsAutoShrink'') as tinyint),
    cast(databasepropertyex(quotename(d.name), ''IsAutoClose'') as tinyint),
    0
    from master.sys.databases d
    where d.name = ' + case when isnull(@lnvc_Catalogue, '') = '' then ' d.name'
    else '''' + @lnvc_Catalogue + ''''
    end + '
    and d.name != ''tempdb'''
    insert into @ltbl_Catalogue (Catalogue, CompatibilityLevel, CreateDate, UserAccess,
    StateDescription, PageVerifyOption, IsReadOnly, IsInStandBy,
    IsAutoShrink, IsAutoClose, Flag)
    exec sp_executesql @lnvc_SQL
    while (select top 1 1
    from @ltbl_Catalogue c
    where c.Flag = 0) = 1
    begin
    select top 1 @lnvc_Catalogue = c.Catalogue
    ,@li_Compatibility = c.CompatibilityLevel
    ,@ldt_CreateDate = c.CreateDate
    ,@lnvc_UserAccess = c.UserAccess
    ,@lnvc_StateDescription = c.StateDescription
    ,@lnvc_PageVerifyOption = c.PageVerifyOption
    ,@lti_IsReadOnly = c.IsReadOnly
    ,@lti_IsInStandBy = c.IsInStandBy
    from @ltbl_Catalogue c
    where c.Flag = 0
    select top 1 @lnvc_Catalogue
    ,@li_Compatibility
    ,@ldt_CreateDate
    ,@lnvc_UserAccess
    ,@lnvc_StateDescription
    ,@lnvc_PageVerifyOption
    ,@lti_IsReadOnly
    ,@lti_IsInStandBy
    if @lnvc_StateDescription = 'ONLINE' and @lnvc_UserAccess != 'SINGLE_USER'
    begin
    -- Build Execution String
    select @lnvc_SQL = N'dbcc checkdb (' + quotename(@lnvc_Catalogue) + ')' + case when @lnc_NoIndex = 'Y' then ', noindex'
    else ''
    end + ' with tableresults, no_infomsgs, all_errormsgs '
    + case when @lnc_PhysicalOnly = 'Y' then ', physical_only'
    else ''
    end
    + case when @lnc_DataPurity = 'Y' then ', data_purity'
    else ''
    end
    -- Option not supported with Compatibility < 100 (SQL Server 2005 and below)
    + case when @lnc_ExtendedLogicalChecks = 'Y' then
    case when @li_Compatibility = 100 then ', extended_logical_checks'
    else ''
    end
    else ''
    end
    + case when @lnc_TabLock = 'Y' then ', tablock'
    else ''
    end
    -- Prepare Processing Environment
    truncate table #ltbl_Output
    set @ldt_ExecutionFinish = null
    set @ldt_ExecutionStart = null
    -- Capture Start Time.
    set @ldt_ExecutionStart = getdate()
    -- Execute the Command.
    insert into #ltbl_Output(Error, Level, State, MessageText, RepairLevel, Status,
    DBID, ObjectID, IndexID, PartitionID, AllocunitID,
    [File], Page, Slot, RefFile, RefPage, RefSlot, Allocation)
    exec sp_executesql @lnvc_SQL
    -- Capture Completion Time.
    set @ldt_ExecutionFinish = getdate()
    -- Add Header Record to Confirm Execution.
    insert into SysAdm.ConsistencyCheck.ExecutionLog(Instance, [Version], Edition, Catalogue, PhysicalOnly,
    NoIndex, ExtendedLogicalChecks, DataPurity, [TabLock],
    Command, ExecutionStart, ExecutionFinish,
    CreatedOn, CreatedBy)
    values(@lnvc_Instance, @lnvc_Version, @lnvc_Edition, @lnvc_Catalogue, @lnc_PhysicalOnly,
    @lnc_NoIndex, @lnc_ExtendedLogicalChecks, @lnc_DataPurity, @lnc_TabLock,
    @lnvc_SQL, @ldt_ExecutionStart, @ldt_ExecutionFinish,
    @ldt_ExecutedOn, @lnvc_ExecutedBy)
    -- Capture Header Record ID
    select @li_ConsistencyCheckID = @@IDENTITY
    -- Were there errors?
    if (select top 1 1
    from #ltbl_Output t) = 1
    begin
    select @li_ConsistencyCheckID, t.Error, t.Level, t.State, t.MessageText, t.RepairLevel,
    t.Status, t.ObjectID, t.IndexID, t.PartitionID, t.AllocunitID, t.[File], t.Page,
    t.Slot, t.RefFile, t.RefPage, t.RefSlot, t.Allocation, @ldt_ExecutedOn, @lnvc_ExecutedBy
    from #ltbl_Output t
    -- Log Failure Entries
    insert into SysAdm.ConsistencyCheck.ErrorLog (ExecutionLogID, Error, Severity, [State]
    ,ErrorMessage, RepairLevel, [Status], ObjectID
    ,IndexID, PartitionID, AllocationUnitID, FileID
    ,Page, Slot, RefFileID, RefPage, RefSlot, Allocation
    ,CreatedOn, CreatedBy)
    select @li_ConsistencyCheckID, t.Error, t.Level, t.State, t.MessageText, t.RepairLevel,
    t.Status, t.ObjectID, t.IndexID, t.PartitionID, t.AllocunitID, t.[File], t.Page,
    t.Slot, t.RefFile, t.RefPage, t.RefSlot, t.Allocation, @ldt_ExecutedOn, @lnvc_ExecutedBy
    from #ltbl_Output t
    -- Configure Alert Mail Subject Line
    set @lnvc_Subject = 'Consistency Check failure for Database ' + quotename(@lnvc_Catalogue) + ' on Instance ' + quotename(@lnvc_Instance) + ' !'
    set @lnvc_ErrorMessage = 'To view more details, logon to the Instance and execute the query: ' +
    + char(13) + char(10) + char(13) + char(10) +
    'select * from sysadm.consistencycheck.ErrorLog where ExecutionLogID = ' + cast(@li_ConsistencyCheckID as varchar) + ''
    + char(13) + char(10) + char(13) + char(10) +
    'Consistency Check Output: ' +
    + char(13) + char(10)
    select @lnvc_SQL = N'set nocount on;select ltrim(rtrim(ErrorMessage)) as Message
    from SysAdm.ConsistencyCheck.ErrorLog r
    where r.ExecutionLogID = ''' + cast(@li_ConsistencyCheckID as nvarchar(128)) + ''''
    exec msdb.dbo.sp_send_dbmail @profile_name = 'SQL Mailbox',
    @recipients = @lnvc_Recipients,
    @subject = @lnvc_Subject,
    @body = @lnvc_ErrorMessage,
    @query = @lnvc_SQL,
    @execute_query_database = @lnvc_Catalogue,
    @query_result_header = 1,
    @query_result_width = 32767,
    @query_no_truncate = 1,
    @body_format = 'TEXT',
    @importance = 'High'
    end
    end
    else
    begin
    -- If we get here, then the database was not processed due to it having a status other than ONLINE, being in SINGLE_USER mode or
    -- having a compatability level < 100
    set @lnvc_Subject = 'Unable to perform consistency checks for Database ' + quotename(@lnvc_Catalogue) + ' on ' + quotename(@lnvc_Instance) + '!'
    set @lnvc_ErrorMessage = 'One of the following conditions was not met. ' + CHAR(13) + CHAR(10) + CHAR(13) + CHAR(10) +
    '* Database must be ONLINE. It''s current state is: ' + @lnvc_StateDescription + CHAR(13) + CHAR(10) +
    '* Database access level cannot be set to SINGLE_USER. It''s current access level is: ' + @lnvc_UserAccess
    exec msdb.dbo.sp_send_dbmail @profile_name = 'SQL Mailbox',
    @recipients = @lnvc_Recipients,
    @subject = @lnvc_Subject,
    @body = @lnvc_ErrorMessage,
    @body_format = 'TEXT',
    @importance = 'High'
    end
    update t
    set Flag = 1
    from @ltbl_Catalogue t
    where t.Catalogue = @lnvc_Catalogue
    end
    /*==============================================================================
    Cleanup Temp Tables
    ==============================================================================*/
    cleanup:
    if object_id('tempdb..#ltbl_Output') is not null
    drop table #ltbl_Output
    /*==============================================================================
    Exit Procedure
    ==============================================================================*/
    quit:
    return @li_Rc
    /*==============================================================================
    Error Processing
    ==============================================================================*/
    errlog:
    -- Raise Error, and write to Application Event Log
    raiserror (@lnvc_ErrorMessage, 16, 1) with log, nowait
    -- Send Email Notification of Error
    exec msdb.dbo.sp_send_dbmail @profile_name = 'Mailbox',
    @recipients = @lnvc_Recipients,
    @subject = @lnvc_Subject,
    @body = @lnvc_ErrorMessage,
    @importance = 'High'
    goto cleanup
    go
    John M. Couch

  • Similar logical host resource configured on 2 different resource groups

    hi,
    I had an issue with logical host setup as follows.
    Background
    We had a failover resource group RGA which is running a critical Oracle instance and listener process.
    It has a logical host resource ora-lh-rs configured with logical host pointing to VirtualHostA.
    I need to create another failover resource group called RGB with another Oracle instance.
    Now at present this Oracle instance (Not under cluster control yet) is listening to the same logical host - VirtualHostA as RGA.
    When I create this new resource group RGB, I need to configure it to share the same logical host as RGA.
    The problem is if I need to add the logical host resource ora-lh-rs with VirtualHostA to this RGB, I foresee that there will be an IP address conflict if I failover RGB to the other cluster node (If my guess is wrong, but logically there should be an IP address conflict if SUN Cluster does not block me from adding the same logical host resource to RGB).
    Question
    Is there any other way to overcome this issue other than to configure the second Oracle instance to listen on a different logical IP?
    To add, RGB is a less priority Oracle instance and will always need to be with RGA on the same node.
    Any suggestions are welcome. My apology if this question sounds stupid as I do not have an UAT environment to test.
    Thanks
    ldd76

    HI Tim,
    Thanks very much for your kind advice. I must say that I have very little experience with SUN Cluster so I beg your pardon if my concept is too superficial.
    The reason why I cannot put both Oracle instance in the same RG is because that' s my boss initial proposal. I will speak to her again on the log_only option.
    But can I confirm that the command looks like this after I add the resources to RGA.
    scrgadm -cj rgb-ora-rs -y Failover_mode=LOG_ONLY (Oracle server)
    scrgadm -cj rgb-lsn-rs -y Failover_mode=LOG_ONLY (Oracle Listener)
    scrgadm -cj rgb-hasp-rs -y Failover_mode=LOG_ONLY (HA Storage Plus)
    As for the logical host questions, it has been legacy that both the Oracle instance listens on the same logical IP(Just that the new and less critical Oracle instance is not under cluster control yet)
    But my gut feel for the reason behind this is that the less important Oracle instance is always running on the same node where RGA is running (since that Oracle instance is used for data warehousing with data replicated from the more critical Oracle instance only) else it is meaningless. Thats my guess why ony one logical IP is used.
    If the direction is still to use RG_affinities, then if I tweak the following steps a bit will it work?
    1) Create RGB.
    2) Activate RGB - scswitch -Z -g RGB
    3) Offline RGB - scswitch -F -g RGB
    4) Failover RGA to the other node
    5) Failover RGB to the other node
    6) Offline RGB on the other node
    7) Failover RGA back to the original node
    8) Failover RGB back to the original node
    Thanks.

Maybe you are looking for

  • Viewer doesn't display correct frame from multicam. Bug?

    I'm able to create a multicam clip no problem for 3 clips.  I've assigned my clips Camera Angle names and used Camera Angles for ordering the clips and automatic / audio synching to create the multicam clip.  When I view the clips in the Event browse

  • Downloading third party software to phone ?

    Hi Everyone, I need to download some spy software from my pc to my phone. It won't let me drag and drop, so how do I get it from my pc onto the phone?

  • Cannot install itunes trailers

    Each time I log onto itunes movie trailers, I can see the itunes trailers app but each time I try and get it, I get told its not available in the itunes UK appstore. When will it be available on itunes UK? I would love to have this app. Is there anyw

  • Non stop problems since update

    Ok, so I updated to 10.4.8 and am now on 10.4.9 as of yesterday. Anyway, upon updating to 8 and deleting my windows partition with bootcamp, I have been having more issues than ever befor. First my internet started disconnecting constantly which seem

  • 2LIS_04_P_COMP and 2LIS_04_P_MATNR delta issue

    Hi experts, I am having problems with 2LIS_04_P_COMP and 2LIS_04_P_MATNR delta extraction. I run the init, it is ok. I create an order and then I run DELTA expecting to get more record(s). DELTA will bring no records. But if I delete set up tables LB